Add Filename to GeDialog
-
On 26/12/2013 at 18:54, xxxxxxxx wrote:
Hello everybody,
sorry for that stupid question, but how can I add a FilenameElement (like UserData/Filename) to a GeDialog. I didn´t find anything in SDK.
Thanks alot
rown -
On 27/12/2013 at 02:27, xxxxxxxx wrote:
There is a filename customgui, you can examine it with the ressource editor plugin. You can also use just storage.SaveDialog().
happy holidays,
ferdinand -
On 03/01/2014 at 13:33, xxxxxxxx wrote:
Hello littledevil,
thx for your reply. It was really helpfull.
Ive solved it in this way:import c4d from c4d import gui #Welcome to the world of Python class Dlg(gui.GeDialog) : TEXT = 10001 SAVE = 10002 PATHSTRING = 10003 OK = 20001 CANCEL = 20002 def CreateLayout(self) : self.GroupBegin(0, c4d.BFH_SCALEFIT, cols=1) self.AddEditText(self.TEXT, c4d.BFH_LEFT, initw=500) self.GroupEnd() self.GroupBegin(0, c4d.BFH_SCALEFIT, cols=2) self.AddEditText(self.PATHSTRING, c4d.BFH_SCALEFIT) self.AddButton(self.SAVE, c4d.BFH_LEFT, initw=30, name="...") self.GroupEnd() self.GroupBegin(2, c4d.BFH_SCALEFIT, cols=2) self.AddButton(self.OK, flags=c4d.BFH_SCALEFIT, name="OK") self.AddButton(self.CANCEL, flags=c4d.BFH_SCALEFIT, name="CANCEL") self.GroupEnd() return True def Command(self, id, msg) : if id == self.SAVE: path = c4d.storage.SaveDialog(type=c4d.FILESELECTTYPE_ANYTHING, title="Export", force_suffix="txt") if path is None: file = "" self.SetString(self.PATHSTRING, path) if id==self.OK: text = self.GetString(self.TEXT) path = self.GetString(self.PATHSTRING) file = open(path, "w") file.write(text) file.close self.Close() if id==self.CANCEL: self.Close() return True def main() : dlg = Dlg() dlg.Open(c4d.DLG_TYPE_MODAL, xpos=550, ypos= 200, defaultw=300, defaulth=10) c4d.EventAdd() if __name__=='__main__': main()
Greetings
rown