On Aug 31, 2006, at 12:08 PM, Miguel Lopes wrote:
> def main(): > app = dabo.dApp() > app.MainFormClass = MainForm > app.start() > > ## > > Can you give me some pointers on how to properly use > dabo.ui.createForm(frmclass, show=False) and also > dabo.ui.dForm.addObject("path/to/.cdxml/file")
It's even easier than that. All you need to do is:
app.MainFormClass = "frmMain.cdxml"
Dabo will recognize that as a Class Designer form class, and use it directly, just as it uses form classes defined in Python code.
You would use createForm() and addObject() just as you would with classes defined in Python code instead of .cdxml files. Let's say that you have a search form that you want to bring up when the user clicks a button. If you defined that form in Python code and named it 'MySearchForm', you'd write: dabo.ui.createForm(MyFormClass). If you created your search form in the Class Designer and saved it in a file named 'searchForm.cdxml', you'd write: dabo.ui.createForm ("searchForm.cdxml"). Dabo understands both, and will in both cases instantiate the form from the class definition.
The same holds true for addObject(). If you want to add a custom control to your form, and you have it defined in Python code as 'MyCustomControl', you'd write: self.addObject(MyCustomControl). If you had defined the control in the Class Designer and saved it in 'customControl.cdxml', you'd write: self.addObject ("customControl.cdxml"). Again, in both cases, Dabo would create the control and add it to the object referenced by 'self'. > What I managed to understand about these methods doesn't seem to be > enough for me to make it work.
You did the smart thing by posting a question, then. Turns out that you were working too hard! We try to make things as simple as possible with Dabo.
-- Ed Leafe -- http://leafe.com -- http://dabodev.com
©2006 Ed Leafe |