How to actually support the LayoutSwitch?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 19/08/2009 at 05:18, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R10 
Platform:   Windows  ;   Mac OSX  ; 
Language(s) :     C++  ;

---------
Im writing a string Custom GUI and would like it to have a minimized and maximized view (with the little arrow switch, like the color description element or the material preview custom gui).

What i did is to override

virtual Bool SupportLayoutSwitch(); (to just return TRUE)
and
virtual void LayoutModeChanged(); (to handle switching, basically to hide and show some stuff)

It doesnt work by just doing that. Looks like im missing something. What else do i have to do?

Thanks in advance,
Yves

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 19/08/2009 at 07:18, xxxxxxxx wrote:

Heres the source code, if it helps...

Nothing fancy, just a slightly modified version of an example i found here.

I naively just did what the documentation suggested. What am I missing?

> class StringSubDialog : public iCustomGui \> { \>           INSTANCEOF(StringSubDialog, iCustomGui) \>      private: \>           BaseContainer m_settings; \>            \>           String m_str; \>           Bool m_tristate; \>            \>      public: \>           StringSubDialog(const BaseContainer &settings;, CUSTOMGUIPLUGIN \*plugin) \>           : iCustomGui(settings, plugin), m_str("[default"), m_tristate(false), m_settings(settings) { } \>            \>           virtual Bool CreateLayout (void) \>           { \>                AddEditText(1000, BFH_SCALEFIT, 75, 20, 0); \>                 \>                return TRUE; \>           } \>            \>           virtual void LayoutModeChanged() \>           { \>                if (GetLayoutMode() == LAYOUTMODE_MAXIMIZED) \>                { \>                     HideElement(1000, FALSE); \>                } \>                else \>                { \>                     HideElement(1000, TRUE); \>                } \>           } \>            \>           virtual Bool SupportLayoutSwitch() \>           { \>                return TRUE; \>           } \>            \>           virtual Bool InitValues() \>           { \>                return TRUE; \>           } \>            \>           virtual LONG Message(const BaseContainer& msg, BaseContainer& result) \>           { \>                return SUPER::Message(msg, result); \>           } \>            \>           virtual Bool Command(LONG id, const BaseContainer& msg) \>           { \>                return TRUE; \>           } \>            \>           virtual Bool SetData(const TriState<GeData> &tristate;) \>           { \>                m_str = tristate.GetValue().GetString(); \>                m_tristate = tristate.GetTri(); \>                 \>                return InitValues(); \>           } \>            \>           virtual TriState<GeData> GetData() \>           { \>                GetString(1000, m_str); \>                return GeData(m_str); \>           } \> }; \> \> \> class StringGui : public CustomGuiData \> { \>      public: \>           virtual LONG GetId() { return SOME_PLUGIN_ID; } \>            \>           virtual CDialog\* Alloc(const BaseContainer &settings;) \>           { \>                StringSubDialog\* dlg = gNew StringSubDialog(settings, GetPlugin()); \>                if (!dlg) return NULL; \>                 \>                CDialog \*cdlg = dlg->Get(); \>                if (!cdlg) return NULL; \>                 \>                return cdlg; \>           } \>            \>           virtual void Free(CDialog \*dlg, void \*userdata) \>           { \>                if (!dlg || !userdata) return; \>                StringSubDialog \*sub = static_cast<StringSubDialog\*>(userdata); \>                gDelete(sub); \>           } \>            \>           virtual CHAR \*GetResourceSym() \>           { \>                return "STRINGTEST"; \>           } \>            \>           virtual LONG GetResourceDataType(LONG \*&table;) \>           { \>                table = restypetable; \>                return sizeof(restypetable)/sizeof(LONG); \>           } \> }; \> \> \> Bool RegisterTestGUI() \> { \>      static BaseCustomGuiLib mylib; \>      ClearMem(&mylib;,sizeof(mylib)); \>      FillBaseCustomGui(mylib); \>       \>      return InstallLibrary(SOME_PLUGIN_ID, &mylib;, 1000, sizeof(mylib)) \>       \>      && \>       \>      RegisterCustomGuiPlugin("My String GUI", 0\*PLUGINFLAG_HIDE, gNew StringGui); \> }

thanks 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/08/2009 at 14:37, xxxxxxxx wrote:

i just noticed that none of those functions get called in my iCustomGui:

virtual LONG CustomGuiWidth();
virtual LONG CustomGuiHeight();
virtual void CustomGuiRedraw();
virtual Bool SupportLayoutSwitch();
virtual void LayoutModeChanged(); .

these are normally called:

virtual void SetLayoutMode(LONG mode);
virtual LONG GetLayoutMode(); .

This just gave me the rest. i could swear that the layout functions were called when i started this thread...

any idea, anyone? 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/08/2009 at 15:08, xxxxxxxx wrote:

i tried to override the functions in this examople and also in some of my other custom guis.

they dont get called.

will they get called if did right or am i riding a dead horse?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/08/2009 at 15:47, xxxxxxxx wrote:

i mean this example: http://www.plugincafe.com/forum/display_topic_threads.asp?ForumID=4&TopicID;=1934

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/08/2009 at 16:07, xxxxxxxx wrote:

I will look into this after the weekend.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 21/08/2009 at 16:13, xxxxxxxx wrote:

Thank you, Matthias!

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/08/2009 at 05:37, xxxxxxxx wrote:

In LayoutModeChanged() you have to call LayoutFlushGroup() and LayoutChanged() with the ID of the group you want to change the layout for. After LayoutFlushGroup() create the layout depending on GetLayoutMode(). At the end call InitValues().

Here some simplified code from the gradient GUI.

> \> void iGradientCustomGui::LayoutModeChanged() \> { \>      LayoutFlushGroup(IDC_GRADIENT_GROUP); \>      CreateGradientGroup(); \>      LayoutChanged(IDC_GRADIENT_GROUP); \>      InitValues(); \> } \> \> void iGradientCustomGui::CreateGradientGroup() \> { \>      if (GetLayoutMode()==LAYOUTMODE_MAXIMIZED) \>      { \>           //create the maximized layout \>           GroupBegin(0,BFH_SCALEFIT|BFV_FIT,1,0,String(),0); \>           { \>                //etc. \>           } \>           GroupEnd(); \>      } \>      else \>      { \>           //create the minimized layout \>           GroupBegin(0,BFH_SCALEFIT|BFV_FIT,0,1, String(),0); \>           { \>                //etc. \>           } \>           GroupEnd(); \>      } \> } \>

Hope this helps.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/08/2009 at 14:39, xxxxxxxx wrote:

Thanks Matthias, that sure helps a lot!

But theres still the problem that the LayoutModeChanged() function and other functions are never called.

I just noticed that theres the CUSTOMGUI_SUPPORT_LAYOUTSWITCH flag for RegisterCustomGuiPlugin(). looks like thats the solution. tesing it now.

... ... that was just too obvious 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 24/08/2009 at 14:46, xxxxxxxx wrote:

it works. some of the iCusotmGui functions are still not called but the layout switch related functions are.

thank you for your help Matthias, layout switching works now!