On Monday 17 November 2008 12:03:17 pm Bob Sysero llc Dev wrote: > Ed Leafe wrote: > > On Nov 15, 2008, at 6:26 PM, Bob Sysero llc Dev wrote: > >> I am using the Dabo ClassDesigner to create a Main Form that has > >> Quick > >> Action Buttons that can changed during the life of the application. > >> What I like to do is create a low level class called menuButton that I > >> can change any of my group buttons called QuickButtons. One way is to > >> use the If elif: > >> > >> If QuickButton == 1: > >> self.Form.QuickButton1.Caption = "Time Clock" > >> self.Form.QuickButton1.Visible = True > >> If QuickButton == 2: > >> self.Form.QuickButton2.Caption = "Time Clock" > >> self.Form.QuickButton2.Visible = True > >> and ........... > >> > >> Is their a better way to do this? > > > > You might want to store the references to the buttons in an array, > > and then reference them by index. So have your menu button call a form > > method when clicked (always better than putting logic in a button!), > > and your form code would look something like this: > > > > in afterInitAll: > > > > self.quickButtons = [self.QuickButton1, self.QuickButton2, > > self.QuickButton3 ... ] > > > > ...and then in the method called by menu button: > > > > def switchButton(btnNum): > > target = self.quickButtons[btnNum] > > target.Caption = "Time Clock" > > target.Visible = True > > > > > > > > -- Ed Leafe > > 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" > > #2 -When setting self.quickButtons in the afterInitAll will my > switchButton see the "self" in the target = self.quickButtons[btnNum]? > > I am trying to understand how dabo works. > > Thank You > > Bob
The ".Form" is required if you are outside of the main form class. Therefore, if you are in the main form class (is it called dForm, or someother name?) all that is required is 'self'. 'self' makes reference to the class instance. It is also not possible to answer your question directly without knowing more info or seeing the code. Is 'QuickButton' defined in the main form class or outside? Check out name space under python. -- John Fabiani _______________________________________________ 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]
