On Fri, Oct 14, 2011 at 09:33:13AM -0700, Paul McNett wrote:
> On 10/14/11 8:03 AM, Ed Leafe wrote:
> >
> >> > Where does this have to go in my AppWizard generated code?
> > I'll let Paul handle that question - I haven't worked with AppWizard
> > code in a very long time.
>
> Code generated by AppWizard is pure Python code. You'd look in the ui/
> directory,
> find the class definition of the object in question, and add your callback
> method and
> the bindEvent() call somewhere, probably in afterInit().
>
> For example, say I wanted to bind to the KeyDown of the clientname textbox in
> the
> edit page of FrmClients. I'd edit the file ui/PagEditClients.py, and I'd find
> the
> clientname definition that looks something like:
>
> 30 ## Field clients.clientname
> 31 label = dabo.ui.dLabel(self, NameBase="lblclientname",
> 32 Caption=biz.getColCaption("clientname"))
> 33 objectRef = dabo.ui.dTextBox(self, NameBase="clientname",
> 34 DataSource="clients", DataField="clientname",
> 35 ToolTipText=biz.getColToolTip("clientname"),
> 36 HelpText=biz.getColHelpText("clientname"))
>
> I would add the following line:
>
> 37 objectRef.bindEvent(dabo.dEvents.KeyDown, self.onKeyDown_clientname)
>
> And scroll to the bottom of the class definition and add this method:
>
> 147 def onKeyDown_clientname(self, evt):
> 148 ed = evt.EventData
> 149 key, char = ed["keyCode"], ed["keyChar"]
> 150 print key, char
> 151 if char.lower() == "a":
> 152 evt.stop()
>
OK, thank you, that's brilliant.
--
Chris Green
_______________________________________________
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/20111014165414.GK5876@chris