THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/11/2012 at 07:52, xxxxxxxx wrote:
How do I return the values from a dialogbox.
I tried to set the var globaly and edit it but no luck.
thanks in advance
kind regards mogh
import c4d
from c4d import gui
variablebox = 0.4 # unnecessary ???
GROUP_ID1=1000
TEXTBOX=1001
BUTTON1=1002
BUTTON2=1003
class ExampleDlg(gui.GeDialog) :
def CreateLayout(self) :
#creat the layout of the dialog
self.GroupBegin(GROUP_ID1, c4d.BFH_SCALEFIT, 3, 1)
self.AddEditText(TEXTBOX, c4d.BFH_SCALEFIT)
self.AddButton(BUTTON1, c4d.BFH_SCALE, name="Start")
self.AddButton(BUTTON2, c4d.BFH_SCALE, name="Close")
self.GroupEnd()
return True
def InitValues(self) :
#initiate the gadgets with values
self.SetString(TEXTBOX, "0.1")
return True
def Command(self, id, msg) :
#handle user input
if id==BUTTON1:
variablebox = self.GetString(TEXTBOX) #here is something wrong <-----
self.Close()
elif id==BUTTON2:
self.Close()
return True
dlg = ExampleDlg()
dlg.Open(c4d.DLG_TYPE_MODAL, defaultw=500, defaulth=80)
def main(undo = True) :
print variablebox #here is something wrong <-----
main()