Dialog boxes and xrced

Hi

I've created a dialog box using xrced with 2 buttons, Connect and Cancel. How do I make it respond to the Connect and Cancel buttons.

This is what I've written so far:

res = wxXmlResource("./dialog_connect.xrc") dlg = res.LoadDialog(self, "DLG_CONNECT") if dlg.ShowModal() = <what goes here?>:

Am I meant to derive a class from wxDialog and use that somehow with the resource file dialog_connect.xrc?

Thanks

With newlines this time (hopefully)

res = wxXmlResource("./dialog_connect.xrc")
dlg = res.LoadDialog(self, "DLG_CONNECT")
if dlg.ShowModal() = <what goes here?>:

sashan wrote:

Hi

I've created a dialog box using xrced with 2 buttons, Connect and Cancel. How do I make it respond to the Connect and Cancel buttons.

This is what I've written so far:

res = wxXmlResource("./dialog_connect.xrc")

> dlg = res.LoadDialog(self, "DLG_CONNECT")
> if dlg.ShowModal() = <what goes here?>:

Am I meant to derive a class from wxDialog and use that somehow with the resource file dialog_connect.xrc?

That is one way to do it. You can use LoadOnDialog to load the resource on an existing dialog instance that has the event handlers setup the way you want (presumably the handlers for the buttons will call EndModal):

  res.LoadOnDialog(myDlg, parent, "DLG_CONNECT")

Or you can ensure that the ID's you use for the buttons are the standard wxID_OK and wxID_CANCEL and then it will use the default EVT_BUTTON handlers for those IDs and you can just check for them as the return values of ShowModal.

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!