From: Alex T. <al...@tw...> - 2005-06-08 12:31:47
|
kim...@ya... wrote: >Hello list, > >I am writing an app involving child-window. When the >child window invokes a dialogbox, it switches focus to >the main windows first, before poping up. Of course, >when it closes, the child-window becomes underneath >the main window. > > > That doesn't happen for me; this little sample below opens its main window, then a child window overlapping it; when you click on the button within the child, the child window stays above the main window with the dialog above the child. After the dialog is closed, the child remains on top and has focus. This might give you somewhere to start comparisons - or if you like, send the code that is misbehaving to me and I'll try to determine where the difference is. >Is there a parameter I am suppose to set or something >in order to maintain the proper z-order? > > > #!/usr/bin/python """ __version__ = "$Revision: 1.5 $" __date__ = "$Date: 2004/04/30 16:26:12 $" """ from PythonCard import model, dialog rsrc = {'application':{'type':'Application', 'name':'Template', 'backgrounds': [ {'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with File->Exit menu', 'size':(400, 300), 'style':['resizeable'], 'menubar': {'type':'MenuBar', 'menus': [ {'type':'Menu', 'name':'menuFile', 'label':'&File', 'items': [ {'type':'MenuItem', 'name':'menuFileExit', 'label':'E&xit', 'command':'exit', }, ] }, ] }, 'components': [ {'type':'TextArea', 'name':'TextArea1', 'position':(52, 82), 'size':(205, 138), 'actionBindings':{}, 'text':'TextArea1', }, {'type':'TextField', 'name':'TextField1', 'position':(10, 10), 'size':(179, -1), 'actionBindings':{}, 'text':'TextField1', }, ] # end components } # end background ] # end backgrounds } } chldrsrc = {'application':{'type':'Application', 'name':'Template', 'backgrounds': [ {'type':'Background', 'name':'bgTemplate', 'title':'Standard Template with no menus', 'size':(400, 300), 'components': [ {'type':'Button', 'name':'btnDialog', 'position':(39, 25), 'actionBindings':{}, 'label':'testDialog', }, ] # end components } # end background ] # end backgrounds } } class myChild(model.Background): def on_initialize(self, event): # if you have any initialization # including sizer setup, do it here pass def on_btnDialog_mouseClick(self, event): result = dialog.singleChoiceDialog(self, "message", "title", ['one', 'two', 'three']) class MyBackground(model.Background): def on_initialize(self, event): # if you have any initialization # including sizer setup, do it here self.childWindow = model.childWindow(self, myChild, None, chldrsrc) self.childWindow.position = (250, 25) pass def on_TextField1_keyPress(self, event): print event.keyCode self.components.TextArea1.text = self.components.TextArea1.text + "%d\n" % (event.keyCode) pass if __name__ == '__main__': app = model.Application(MyBackground, None, rsrc) app.MainLoop() -- Alex Tweedly http://www.tweedly.net -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.6.2 - Release Date: 04/06/2005 |