OK, I guess I'm missing something obvious about the Update event. I
don't seem to be able to bind to it, either explicitly or automatically.
In the code below I define a textbox class that has two auto-bound
event handlers: the handlers are for the Update and KeyChar events. I
then manually add bindings to these same two events.
The form has an instance of this textbox, along with two buttons
that call self.Form.update() and self.Form.pnl.update(). 'pnl' is the
panel on which the controls sit. When you run the form, both of the
key event bindings work as expected, but neither of the Update events
seem to ever fire. I've put debug code in the guts of
dPemMixin.__onUpdate() to confirm that *that* handler is being
called, but none of the other Update handlers are ever called.
What am I missing?
-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
import wx
import dabo
dabo.ui.loadUI("wx")
class TestText(dabo.ui.dTextBox):
# Define two auto-bound events: Update and KeyChar
def onUpdate(self, evt):
print "AUTOBIND UPDATE"
def onKeyChar(self, evt):
print "AUTOBIND KEYCHAR"
def afterInit(self):
# Now add manual bindings
self.bindEvent(dabo.dEvents.Update, self.manualUp)
self.bindEvent(dabo.dEvents.KeyChar, self.manualKey)
def manualUp(self, evt):
print "MANUAL UP"
def manualKey(self, evt):
print "MANUAL KEY"
class TestForm(dabo.ui.dForm):
def afterInit(self):
self.pnl = pnl = dabo.ui.dPanel(self)
self.Sizer.append1x(pnl)
pnl.Sizer = sz = dabo.ui.dSizer()
txt = TestText(pnl)
sz.append(txt)
btn = dabo.ui.dButton(pnl, Caption="Form", OnHit=self.formUpd)
sz.append(btn)
btn = dabo.ui.dButton(pnl, Caption="Panel", OnHit=self.pnlUpd)
sz.append(btn)
def formUpd(self, evt):
print "FORM UP"
self.update()
print "-"*20
def pnlUpd(self, evt):
print "PNL UP"
self.pnl.update()
print "-"*20
if __name__ == '__main__':
app = dabo.dApp()
app.MainFormClass = TestForm
app.start()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]