In a message dated 8/8/2009 12:48:57 P.M. Eastern Daylight Time, [email protected] writes:
In general, the "trick" is to use dialogs for these sorts of helper forms, and use the fact that such modal dialogs stop the process that called them until the dialog is either hidden or destroyed. You then make sure that the ok/cancel buttons only *hide* the dialog, and not close/destroy it. The calling code looks something like this: dlg = MyDialogClass() dlg.show() # execution pauses here until the dialog is hidden if dlg.Accepted: # User clicked OK result = dlg.someAttributeThatHoldsTheResult self.doSomethingWithIt(result) dlg.release() The 'Accepted' property will be set to True when the user clicks 'OK'; otherwise, it is False. In your dialog code, you need to store the user's input/selection into an attribute, or add a method to fetch that value, so that the calling form can act on that value. And once you have gotten the information from the dialog, you need to manually call release() to destroy it. Hope that gives you a general idea how to do this. If you have any other questions, ask away! -- Ed Leafe Thanks, Ed, that's helpful. I do have some more questions! Paul also posted some example code that parallels what you're saying: def onHit_button1(self, evt): dlg = MyDialog(self) dlg.showModal() ret_value = dlg.lookup.Value dlg.release() print ret_value In this example, we have "dlg = MyDialog(self)" which instantiates your MyDialog class as dlg. My question is how do I turn a dialog I've designed in the class designer into a class that I can refer to in this way? I can't seem to save the dialog form as anything but "cdxml" -- (why not as python code?) -- I'm guessing there's a way to define the class using this cdxml file? Is there a tool that will convert cdxml to python? Thanks for you help! --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
