Author: Ed Leafe
Posted: 2009-08-10 at 01:37:53
On Aug 9, 2009, at 9:14 PM, jpoorrandp@aol.com wrote:
> dlg = dabo.ui.createForm("MyDialog.cdxml", self)
>
> What I had was:
> MyFind = dabo.ui.createForm("findRun2.cdxml", self)
> dlg = MyFind(self)
> dlg.show()
>
> Why wouldn't that work?
Because 'createForm' creates an instance of the form. You're treating
it as though it returns a class, not an instance.
> I switched to a simple dOKCancelDialog that has a label and a
> textbox for
> entering the search value. When I click my "find" button, the dialog
> appears. If I fill in something in the textbox and click OK, the
> dialog flashes
> and stays there. If I click OK again, it vanishes and the code back
> in the
> calling form executes with no probs. Same with cancel, the first
> click makes
> the dialog "wink" and the second click closes it, and code does not
> execute. So, only problem is it's taking two clicks to get the
> dialog to close.
That's odd - I've used lots of these dialogs, and have never seen
that behavior. Do you have any extra code in the OK button of the
dialog? Or anything else you can think of that could possibly
interfere with the button's action?
> Also, I'd like the dialog to start up with the cursor in the
> textbox, so
> user can just start typing. Is there a way to set the focus to the
> textbox
> on startup?
I would do this: give the textbox a RegID value (let's say it's
'maintext'), and then add this code to the dialog's afterInitAll():
self.maintext.setFocus()
-- Ed Leafe