Solved Some confusing things about Python standard dialogs


I was just going through the standard dialogs in the Python API like MessageDialog etc ( ; most of which do not exist in this form in the C++ API), and there are some questions open...

  1. The flag GEMB_FORCEDIALOG is unexplained (well, the explanation is "Forces dialog"). What does it actually do? I tried it in a script and see no change whether I use it or not.

  2. When does a MessageDialog return GEMB_R_UNDEFINED? (Does it ever?)

  3. The input dialog shows an OK and a Cancel button and can be closed with the Window Close icon. But it always returns the input string, other than RenameDialog which looks almost the same but returns None if the user presses Cancel.
    To be fair, the description does say that (no screenshot though). But what is the Cancel button for, then?

  4. The ColorDialog has ominous Flags as first parameter. The doc doesn't say which flags. I have found that you can use (some of) the DR_COLORFIELD_xxx flags to hide some parts of the color gadget (most of the _NO_ ones), but not all of them. The ColorDialog always opens in the mode it was closed in; the _ENABLE_ flags do not affect the state.
    Is there a list of the flags that actually take effect? Maybe there are more than just COLORFIELD?

  5. The SelectionListDialog has an X and a Y coordinate in the parameters. They don't seem to do anything, though? The menu always open at the mouse position. I would use c4d.MOUSEPOS, as for ShowPopupDialog, but the doc doesn't mention that.

(Using the newest online docs here.)

Thanks for information on these points!

thanks for your questions :)

1 - Probably the only case is when you have a team render client, this will force the popup to be displayed on the client. Otherwise i don't see where i can be usefull.

2 - GEMB_R::V_UNDEFINED That's the "default" state. So it will only return that function in the case of the other case (OK, CANCEL ...) failed. It's used in different dialog and always the same thing. Init with this value and than handle other cases.

3 - Looks like a bug I've Opened a bug entry for that one. In fact InputDialog just return true in its Command function.

4 - internally it's using GeChooseColor witch use AddColorChooser the flags will be transfered to the layoutflags of that function, so every DR_COLORFIELD could be used. (i didn't tested all)
The current config is stored in the WorldBaseContainer. Something like this will remove it.
the symbol is COLORCHOOSER_POPUP_LAYOUT_ID but it's not exposed so you have to use its ID.

    bc = c4d.GetWorldContainerInstance()

5 - this function is using internally the c++ function SelectionListShowMenu both are bugged (if i can call it so) the position is ignore and MOUSEPOS is used. I've opened a bug report.

I hope i got every question answered, please point me to the I forgot if there's some :)


MAXON SDK Specialist

MAXON Registered Developer

@m_magalhaes thanks, that'll do! :+1: