dabo Commit Revision 143 Date: 2004-03-31 13:41:40 -0800 (Wed, 31 Mar 2004) Author: paul
Log: Started implementing the select page.
While working on that, I discovered that in 2.5 the setfocus/killfocus code wasn't running in the controls on the edit page, and remembered that Ed mentioned something like that the other day. The common factor must be GTK2 versus GTK1, and it came down to adding event.Skip() in the form's SetFocus code - I had just added SetFocus/KillFocus code in the form on my airplane ride.
Tested this in wx2.4/GTK1 as well as in wx2.5/GTK2.
It sure is hairy how my changes may work fine on my computer yet break something on another computer. I guess that is what we get for developing multi-platform using the native toolkits on each platform.
By the way, event binding will be much simpler in 2.5, as they've introduced the form:
self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
to bind events to methods, which feels a lot like VFP's BINDEVENT() does it not?
Changed: U trunk/ui/uiwx/classes/dFormDataNav.py U trunk/ui/uiwx/classes/dPage.py U trunk/ui/uiwx/classes/dPageFrame.py
Diff: Modified: trunk/ui/uiwx/classes/dFormDataNav.py =================================================================== --- trunk/ui/uiwx/classes/dFormDataNav.py 2004-03-31 16:54:44 UTC (rev 142) +++ trunk/ui/uiwx/classes/dFormDataNav.py 2004-03-31 21:41:40 UTC (rev 143) @@ -22,6 +22,8 @@ def afterSetPrimaryBizobj(self): self.setupToolBar() self.setupMenu() + + def afterSetPrimaryColumnDef(self): self.setupPageFrame() def setupToolBar(self): @@ -273,6 +275,8 @@ column['selectTypes'].append('stringMatchAll') self._columnDefs[dataSource] = columnDefs + if dataSource == self.getBizobj().dataSource: + self.afterSetPrimaryColumnDef() def OnSetFocus(self, event): @@ -283,6 +287,7 @@ if isinstance(self, wx.MDIChildFrame): self.setupToolBar() self.setupMenu() + event.Skip() def requery(self):
Modified: trunk/ui/uiwx/classes/dPage.py =================================================================== --- trunk/ui/uiwx/classes/dPage.py 2004-03-31 16:54:44 UTC (rev 142) +++ trunk/ui/uiwx/classes/dPage.py 2004-03-31 21:41:40 UTC (rev 143) @@ -51,8 +51,43 @@ event.Skip() -class dSelectPage(dPage): pass +class dSelectPage(dPage): + + def fillItems(self): + dataSource = self.getDform().getBizobj().dataSource + columnDefs = self.getDform().getColumnDefs(dataSource) + stringMatchAll = [] + + for column in columnDefs: + for selectType in column["selectTypes"]: + if selectType == "stringMatchAll": + stringMatchAll.append(column) + + if len(stringMatchAll) > 0: + labelCaption = "String Match:" + labelWidth = 150 + + bs = wx.BoxSizer(wx.HORIZONTAL) + + labelAlignment = wx.ALIGN_RIGHT + + label = dLabel(self, windowStyle = labelAlignment|wx.ST_NO_AUTORESIZE) + label.SetSize((labelWidth,-1)) + label.SetName("lblStringMatchAll") + label.SetLabel(labelCaption) + + objectRef = dTextBox(self) + objectRef.SetName("stringMatchAll") + + bs.Add(label) + bs.Add(objectRef, 1, wx.ALL, 0) + + self.GetSizer().Add(bs, 0, wx.EXPAND) + + self.GetSizer().Layout() + + class dBrowsePage(dPage): def __init__(self, parent): dPage.__init__(self, parent, "BrowsePage") @@ -67,6 +102,7 @@ self.createGrid() if self.gridExists and pf.GetPage(pf.GetSelection()) == self: self.fillGrid() + event.Skip() def onEnterPage(self): if not self.gridExists: @@ -107,6 +143,8 @@ self.Enable(True) else: self.Enable(False) + if event: + event.Skip() def fillItems(self): dataSource = self.getDform().getBizobj().dataSource @@ -140,8 +178,7 @@ else: classRef = dTextBox - objectRef = classRef(self) - objectRef.SetName(fieldName) + objectRef = classRef(self, fieldName) objectRef.dataSource = dataSource objectRef.dataField = fieldName objectRef.Enable(fieldEnabled)
Modified: trunk/ui/uiwx/classes/dPageFrame.py =================================================================== --- trunk/ui/uiwx/classes/dPageFrame.py 2004-03-31 16:54:44 UTC (rev 142) +++ trunk/ui/uiwx/classes/dPageFrame.py 2004-03-31 21:41:40 UTC (rev 143) @@ -31,7 +31,9 @@ self.AddPage(dBrowsePage(self), "Browse", imageId=1) self.AddPage(dEditPage(self), "Edit", imageId=2) + self.GetPage(0).onEnterPage() + def OnPageChanged(self, event): ls = self.lastSelection cs = event.GetSelection()
©2004 noreply /AT/ paulmcnett .D.O.T com |