Ed Leafe wrote: > On Nov 17, 2008, at 2:03 PM, Bob Sysero llc Dev wrote: > > >> Quick question in the ClassDesigner using the editor when I select >> Form >> and then the method afterInitAll: >> self.quickButtons = [self.QuickButton1, self.QuickButton2, ... ] >> >> #1 - Why is the "Form" not included in the"self.QuickButton1" like >> "self.Form.QuickButton1" >> > > The 'Form' property refers to "the form in which I am contained". > Since the form is not contained by any other form, 'self.Form' would > evaluate to None. > > Using RegIDs add those IDs to the form as addressable attributes. > > >> #2 -When setting self.quickButtons in the afterInitAll will my >> switchButton see the "self" in the target = self.quickButtons[btnNum]? >> > > > I'm not quite sure what you mean. Are you thinking that the literal > string 'self.quickButtons' is stored, perhaps? That's not the case. > Rather, 'self.quickButtons' is resolved to an attribute of the form, > which is a list of buttons, and then the index value in 'btnNum' is > used to obtain a reference to a particular button. Any remaining code > that uses that reference doesn't care how the reference was arrived > at; all it cares is that it is a reference to an object. > > > -- Ed Leafe MyCode.py def quickButton( self, num, value ): menuButton = self.quickButtons[num] menuButton.Caption = value menuButton.FontBold = True
def setQuickButtons( self ): self.quickButtons = [self.QuickButton1,self.QuickButton2,self.QuickButton3, \ self.QuickButton4,self.QuickButton5,self.QuickButton6] quickButton( self, 0, 'OREDER') self.quickButtons[1].Caption = 'Shipping\nReceiving' self.quickButtons[1].FontBold = True self.quickButtons[1].refresh() self.Form.QuickButton3.Caption ="INVOICE" self.Form.QuickButton3.FontBold = True File "/usr/lib/python2.5/site-packages/dabo/lib/eventMixin.py", line 92, in raiseEvent bindingFunction(event) File "/tmp/tmpzuKeoQ.py", line 347, in onHit MyCode.setQuickButtons( self ) File "/home/bobsysero/0SyseroProjects/SyseroSBOMain TEST/ui/MyCode.py", line 10, in setQuickButtons self.quickButtons = [self.QuickButton1,self.QuickButton2,self.QuickButton3, \ AttributeError: 'dButton_96333701979440120326' object has no attribute 'QuickButton1' The line below created the error because the self.QuickButton3 -----> self.quickButtons = [self.QuickButton1,self.QuickButton2,self.QuickButton3, \ -----> self.QuickButton4,self.QuickButton5,self.QuickButton6] In the classDesigner my BusinessButton1 onHit calls MyCode.setQuickButtons(self) in the MyCode.py by passing self. All my Buttons designed in my ClassDesigner set the RegID like QuickButton1. When I change the line to this: self.quickButtons = [self.Form.QuickButton1,self.Form.QuickButton2,self.Form.QuickButton3, \ self.Form.QuickButton4,self.Form.QuickButton5,self.Form.QuickButton6] In the Wiki RegID: When the form runs, the object will register itself with the form automatically, and after that you can then refer to it from anywhere using form-dot-RegID. Example: if you set your grid's RegID to be OrderGrid, the code to reference it would be self.OrderGrid from within form methods, and self.Form.OrderGrid from any other object within the form. What I think this is telling me is I am dealing with two defrent objects within the form. Because of that I need to use the self.Form to avoid the "object has no attribute 'QuickButton1" error. Am I on the right track? I think I got it! Bob _______________________________________________ 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]
