On Monday 27 July 2009 01:15:20 pm [email protected] wrote: > OK I'm working on the "Step by step " application, and now I've made > progress on the "Add Hours" screen. But I'm getting an error on the save > button OnHit code: > > def onHit(self, evt): > if self.Form.save(): > # A failed save will return False. We only want to proceed if > # the save succeeds. > self.Form.new() > self.Form.servicedate.setFocus() > > > On clicking save, the entry is indeed saved, and a new record is setup for > the screen, but the setFocus causes an error (see below for full listing) : > <<object has no attribute 'serviceDate'>> > > I understand that this code is supposed to put cursor back on the date > field so a new entry can be made. I don't understand why referring to the > dDateTextBox object as 'serviceDate' would work, other than that this is > the value of the datafield property (and the name of the field in the hours > table). > > I tried using << self.Form.dDateTextBox.setFocus() >> and got the same > error. > > Thanks for any help... > > Jonathan Poor > > ===Here's the traceback:===== > > C:\Documents and Settings\Jonathan Poor\DABO\ClientHours>python main.py > Traceback (most recent call last): > File > "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\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\tmptidzcf.py", line 314, in onHit > self.Form.serviceDate.setFocus() > AttributeError: 'dForm_31385' object has no attribute 'serviceDate'
Using the ClassDesigner open the form in question. Select the dDateTextBox in question. Now edit the 'RegID' by place a string in the field such as 'myDateBox' or any string that you think it should be. Now replace 'servicedate' with the same string you entered into the 'RegID' property. self.Form.myDateBox.setFocus() RegID's are simple way to access a control on the form. You'll see the value of them soon. Do not confuse 'RegID' with 'Name' they are not the same. Johnf _______________________________________________ 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]
