GeDialog command

On 29/08/2017 at 14:12, xxxxxxxx wrote:

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

---------
hi guys
i have a images in folder , i loop to it to ceate a BitmapButtonCustomGui, in the for loop i use one define ID,
i want to konw how i can use the button  in a gedialog command, 
thanks

On 29/08/2017 at 19:19, xxxxxxxx wrote:

I guess everything you need is written here

Typically in a Gedialog when you create a widget (independant from it's type, it can be a slider, a button or a customGui for exemple) you assign them an unique ID. And whhen user click it's trigger Command function with this Unique ID as id.

Since you are in a dynamics things you may want to do something like this (its pseudo code)

UI_ID = 1001
MAX_ELEMENT = 100
  
def CreateLayout(self) :
  #ensure user will not ovveride others id
  if nb_widget > MAX_ELEMENTS: return True
  
  for i in xrange(nb_widget) :
    CreateMyWidget(UI_ID + i) #you are sure every widget created get an unique id
  
def Command(self, id, msg=None) :
  if UI_ID <= id < UI_ID + MAX_ELEMENT:
	element = id - UI_ID

I also suggest you to read the C++ manual about Gedialog it can be helpful even if you develop in python.

Finally welcome here!  😉

On 30/08/2017 at 11:34, xxxxxxxx wrote:

thinks 👍