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.




OK, I've managed to instantiate my FindRun dialog (using the cdxml file  
generated by the CD) and launch it from the button onHit code. The dialog is  
modal, and lets me enter a Run ID I want to find.
 
When I click the OK button, the dialog disappears, and I get an error in  
the command window. The main program keeps running, and terminates normally.  
Here's the traceback:
 
C:\DOCUME~1\JONATH~1\DABO\runs>python main.py
Traceback (most recent  call last):
File  "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\u
iwx\dControl
Mixin.py",  line 27, in _onWxHit
self.raiseEvent(dEvents.Hit, evt,  *args, **kwargs)
File  
"c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dPemMixi
n.py",  line 949, in raiseEvent
super(dPemMixin,  self).raiseEvent(eventClass, nativeEvent, *args, **kwargs)
File  
"c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\lib\eventMixin.p
y",  line 93, in raiseEvent
bindingFunction(event)
File "c:\docume~1\jonath~1\locals~1\temp\tmp2z_20l.py", line 238, in  onHit
self.Form.find_run()
File  "c:\docume~1\jonath~1\locals~1\temp\tmp2z_20l.py", line 208, in  
find_run
dlg = MyFind(self)
TypeError: 'dDialog_23949'  object is not callable
 
My guess is that the dialog isn't really alive anymore when I return to the 
 calling code. So, my questions are:
 how do I hide the dialog?
 Which type of dialog should I be using in Class Designer? (I picked  the 
"plain dialog")
 Do all dialogs have this "Accepted" property (I don't see it listed  in 
the API documentation for dDialog, but it is listed for "Preference  dialog")
 
Thanks again,
Jonathan Poor
 


--- 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]

Reply via email to