GroupBorderNoTitle change GUI or flags after user input



  • Dear developers,

    I would like to change the appearance of a group with these nice border styles after the user interacted with the interface. (inserting a filepath)

    self.GroupBorderNoTitle(c4d.BORDER_NONE) # filepath fine
    self.GroupBorderNoTitle(c4d.BORDER_ACTIVE_4) # orange filepath empty
    self.GroupBorderNoTitle(c4d.BORDER_ACTIVE_3) # red filepath does not exist
    

    I have a def Command(self, id, msg): section which checks the inputs but I cannot "change" the interface cosmetically in this section - still self.SetString(1103, str(self.folder)) works as intended ...

    how would this be feasible for changing elements where no dedicated "SET" is available.

    thank you for your time.
    mogh



  • Hello mogh.

    I usually come over such tasks by having a helper routine that does the layout (re-)building.
    In that routine, I can freely decide the gadget's appearance based on certain conditions. After rebuilding, the "old" gadgets have to be removed and replaced by the new ones and the only thing that's left is the refreshing of the dialog. Note that this only works for dynamic gadgets/groups.



  • Thanks @mp5gosu

    you pointed me in the right direction I have some working code for now, even though I fear that I don't know what I am doing with all these classes 🙏

    this script example helped me a little bit even though its pretty rough

    https://github.com/PluginCafe/cinema4d_py_sdk_extended/blob/master/scripts/03_application_development/gui/dialog/customgui_quicktab_r19.py

    kind regards mogh



  • Hi @mogh,

    thank you for reaching out to us and thank you @mp5gosu for providing help. I think the most meaningful thing I can say is that GeDialog is pretty forgiving and not as strict as the sum of its methods might imply; at least that was my insight to be gained when I encountered the class first. Since you said you consider this to be still rough, here are some tips that might be helpful.

    All following method references are members of GeDialog.

    • You can define and load file based resources for dialogs, just like it is implicitly done with descriptions, with LoadDialogResource. This helps to clean up GeDialog implementations from the inherent clutter that comes with complex interface definitions. You can also do this to some extent in a modular fashion, i.e., invoking LoadDialogResource multiple times will not replace the former content but instead append new content.
    • CreateLayout is mostly a convenience method. Or in other words, there is nothing which does prevent you from modifying the resource of a dialog from anywhere else where you have access to the dialog instance (be careful with threading though).
    • Resources are organized in groups and you can flush these groups with LayoutFlushGroup, for example to rebuild them on user interaction. Single arbitrary elements can be removed by invoking RemoveElement. The relevant methods are all grouped under Dialog Change Methods in the GeDialog documentation.

    If anything remains unclear, please do not hesitate to ask.

    Cheers,
    Ferdinand