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 > I like this idea better that you have came up with because I can understander array methods. I need time to learn how to use the dynamic and overlay concepts that I lack the experience at this time with python and Dabo. In time I want to learn how to us these new ideas. I am finding out how powerful python is compared to the other languages I have used.
Thank You 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]
