Author: johannes Date: 2006-03-07 09:23:23 -0600 (Tue, 07 Mar 2006) New Revision: 8213
Modified: trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py Log: Fixed initial focus for dialogs Modified: trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py =================================================================== --- trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py 2006-03-07 14:24:12 UTC (rev 8212) +++ trunk/gnue-forms/src/uidrivers/wx26/UIdriver.py 2006-03-07 15:23:23 UTC (rev 8213) @@ -148,7 +148,11 @@ for child in self._children: if child._form.name == formName: - child.mainWindow.Hide () + window = child.mainWindow + if isinstance (window, wx.Dialog) and window.IsModal (): + window.EndModal (-1) + else: + window.Hide () exitApp = exitApp and not child.mainWindow.IsShown () Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py =================================================================== --- trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py 2006-03-07 14:24:12 UTC (rev 8212) +++ trunk/gnue-forms/src/uidrivers/wx26/widgets/button.py 2006-03-07 15:23:23 UTC (rev 8213) @@ -50,24 +50,14 @@ size = (self.itemWidth, -1) newWidget = wx.Button (event.container, -1, self._gfObject.label, pos, size) - newWidget.Bind (wx.EVT_BUTTON, self.__click) + newWidget.Bind (wx.EVT_BUTTON, lambda x: self._gfObject.doFire ()) newWidget.Bind (wx.EVT_SET_FOCUS, self.__setFocus) return newWidget # --------------------------------------------------------------------------- - # Eventhandler for button clicks - # --------------------------------------------------------------------------- - def __click (self, event): - - self._gfObject.doFire () - event.Skip () - - - # --------------------------------------------------------------------------- - def __setFocus (self, event): if self._form._currentEntry != self._gfObject: Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py =================================================================== --- trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-03-07 14:24:12 UTC (rev 8212) +++ trunk/gnue-forms/src/uidrivers/wx26/widgets/form.py 2006-03-07 15:23:23 UTC (rev 8213) @@ -166,6 +166,15 @@ def showModal (self): self.mainWindow.Raise () + + # FIXME: this is a really dirty workaround. Although the focus is set + # properly in the GFForm, it is misplaced in the wx.Dialog after calling + # ShowModal (). If we would use Show () here everything's find. I was not + # able to create a standalone wx-app reproducing the situation. The bug + # does not appear on wxMSW or wxMac. + if 'wxGTK' in wx.PlatformInfo: + wx.CallAfter (self._request, 'FOCUS', data = self._form._currentEntry) + self.mainWindow.ShowModal () _______________________________________________ Commit-gnue mailing list Commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue