THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2010 at 17:18, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12
Platform: Windows ;
Language(s) : PYTHON ;
---------
Im a beginner in Python coding and I stumbled about something I don't understand. Perhaps someone here could enlighten me.
I don't know if it is a bug in the documentation of the Python SDK or just my inexperience.
In the Python SDK you find the following about "c4d.gui.ShowPopupDialog":
[QUOTE]c4d.gui.ShowPopupDialog(x, y, bc, flags=POPUP_RIGHT|POPUP_EXECUTECOMMANDS)
Displays a popup menu:
import c4d
from c4d import guientries = c4d.BaseContainer()
entries.SetString(0, "Title&d;&") #append &d;& to grey entry out
entries.SetString(2, "Hello")
entries.SetString(3, "World!")
result = gui.ShowPopupDialog(cd=None, bc=entries, x=70, y=90)
print result
Parameters: ° x (int) – The X position.
° y (int) – The Y position.
° bc (BaseContainer) – The container with the elements. The elements has to be of type str. You can optional set a title with the ID 0 or just start with the first element with the ID 2. If you set a title, we recommend you to add the string &d;& to the name of the title (see example) to grey it out. The title cannot be selected, even its not greyed out.
° flags (int) –
One of the following flags:
POPUP_ABOVE Open above mouse.
POPUP_BELOW Open below mouse.
POPUP_CENTERVERT Open centered vertically around mouse.
POPUP_LEFT Open to the left of the mouse.
POPUP_RIGHT Open to the right of the mouse.
POPUP_CENTERHORIZ Open centered horizontally around mouse.
POPUP_EXECUTECOMMANDS Execute commands immediatly.
POPUP_ALLOWUNDOCK Allow to undock popupmenu.
POPUP_ALLOWUNDOCK_REC Allow to undock popupmenu for children.
Return type: int
Returns: The ID of the selected item, or 0 if nothing was selected.
[/QUOTE]
In the definition there is nothing about the parameter "cd" but in the example you could find "cd=None" which also seems to be really necessary for this function to work.
But what does it mean, what is it for and why isn't it mentioned in the definition of this function?
And what is the precondition to use the flags?
Cause if I tried to use them I got "NameError"s that the name of the flags wouldn't be defined (I used "import c4d" and "from c4d import gui").