Nate Lowrie <[EMAIL PROTECTED]> writes:

> Note the use of RegID's.  You need them so that an event function like
> onHit_btnOk will be linked to the hit of the btnOk widget.  You can
> get away with not using them in the form, but if you break your GUIs
> up into panel classes and such you really need to start using it.

wow, this is a nice trick. it eliminates the need to specifically bind the 
event. 

why isn't the OK button centered horizontally? in this line
btnSz.append(dabo.ui.dButton(self.pnl, Caption = "OK", RegID="btnOk"), 
halign = "center")

halign = "center" should center the button, correct?

also, i noticed if i move self.MenuBar = None into function initProperties, it
doesn't work. is it the original intention? i tried put in there first because
Paul showed me
something like this in his earlier reply:

def initProperties(self):
    self.MenuBar = MyMenuBar()

thank you.


import dabo
dabo.ui.loadUI("wx")

class TestForm(dabo.ui.dForm):
   def afterInit(self):
       self.MenuBar = None   
       self.Sizer = dabo.ui.dSizer("v")
       self.pnl = dabo.ui.dPanel(self)
       self.Sizer.append1x(self.pnl)
       self.pnl.Sizer = mainSz = dabo.ui.dSizer("v")

       lblSz = dabo.ui.dSizer("h", DefaultSpacing=5, DefaultBorder=20,
DefaultBorderLeft=True, DefaultBorderRight=True)
       lblSz.append(dabo.ui.dLabel(self.pnl, Alignment = "Center",
Caption= "This is a test.", RegID="lblMsg"))

       btnSz = dabo.ui.dSizer("h")
       btnSz.append(dabo.ui.dButton(self.pnl, Caption = "OK", 
RegID="btnOk"), halign = "center")

       mainSz.append(lblSz, "expand", 1)
       mainSz.append(btnSz, "expand", 0)

   def initProperties(self):
       self.Caption = "TestForm"    
       self.Size = (200, 400)
       self.Position = (300, 200)
       
   def onHit_btnOk(self, evt):
       print "OK button clicked."    

if __name__ == "__main__":
       app = dabo.dApp()
       app.MainFormClass = TestForm
       app.start()





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to