Unsolved How to Dynamically Change the Size of Dialog Window

Thank you @ferdinand !

While you're here, for this script I'd love to implement a toggle-able option and I've come so far as to hide the elements that are affected, however the dialog won't resize to the new, smaller size no matter what I do. I've tried LayoutChanged, different initializations for the dialog and a lot of googling.. is it even possible? How would I best go about doing this so the plugin window doesn't start up with a big empty blob where the extra options would be?

Thank you in advance!


Hello @HerzogVonWiesel,

Thank you for reaching out to us. This question of yours did deviate too far from the subject of breaks-viewport-rendering-when-script-is-docked. Due to that, your posting has been forked. Note that our Forum Guidelines state:

  • A topic must cover a singular subject; the initial posting must be a singular question.
    • Users can ask follow-up questions, asking for clarification or alternative approaches, but follow-up questions cannot change the subject.
    • When the subject of the topic is "How to create a cube object?", then a follow-up question cannot be "How to add a material to that cube?" as this would change the subject.
    • A valid follow-up question would be "Are there other ways to create a cube object, as the proposed solution has the drawback X for my use-case?" or "Could you please clarify the thing Y you did mention in your answer, as this is still unclear to me?".
    • There is some leverage-room for this rule, but it is rather small. Small changes in the subject are allowed, large changes are not.

Please try to follow these rules in the future. It is certainly no catastrophe when users violate these from time to time, as it can be tricky to decide when something is on-topic or not. But we must enforce this rule to a reasonable degree, so that the forum remains a searchable knowledge base.

About your Question

I assume you want the dialog window to dynamically change size based on how you reconstruct the layout at runtime. Doing this is not possible, you have no control over the size of a dialog window except for the arguments for the width and height you can pass to GeDialog.Open. Once the dialog is open, you have no control over its size.

  • When you have a dialog where you do not know how large it will be when you open it with GeDialog.Open, set defaultw and defaulth both to 0, the dialog will then automatically scale to its minimum size.
  • Doing the same at runtime is not possible (for example when the layout is dynamic), as this would result in windows "magically" resizing themselves, which is a big no-no UX-wise.
  • You can use the layout flags of your gadgets to place elements in a more aesthetic manner when there is excess space. You could for example do something like this:

  GROUP ID_GROUP_MAIN // The outmost layout group.
    SCALE_H; SCALE_V; // It will consume all space in the dialog.

    GROUP ID_GROUP_ITEMS // An inner group which contains all the options of the dialog.
      FIT_H; // It will only consume the space it requires horizontally, i.e., the height of two
             // text edit gadgets.

      EDITTEXT ID_EDIT_A { SCALE_H; SIZE 256, 0; }; // A gadget with a fixed height, no SCALE_V
      EDITTEXT ID_EDIT_B { SCALE_H; SIZE 256, 0; }; // A gadget with a fixed height, no SCALE_V
    //  ... Cinema will render here whitespace when the dialog is taller then 2 edit fields + a button

    // The "Run" or "Do Stuff" button of the dialog, it will always stick to the bottom of the
    // dialog window.

You do not need to use a dialog resource for that you can do the same with the methods of GeDialog.


MAXON SDK Specialist

Thank you again @ferdinand !

Sad that resizing windows is not a possibility. Would've been nice to have the options pop up once you toggle the extra options on! Now I've implemented them as a modal dialogue so you can choose them and close it again.

Thank you for your help!