johnf wrote: > On Wednesday 13 June 2007 07:32, Ed Leafe wrote: >> On Jun 13, 2007, at 10:12 AM, Uwe Grauer wrote: >>> Still don't know what to do. >>> Up to now i used this in my form: >>> vs.append(dabo.ui.dButton(self, Caption="Show / Edit", >>> Name="btnShow", OnHit=self.onHit_btnShow), alignment="middle", >>> border=5) >>> >>> and then: >>> def onHit_btnShow(self, evt): >>> self.Form.callEditPer(False) >>> >>> Is this the prefered method? >> "Preferred" is a matter of taste. The two main ways of binding is to >> pass the "On*" parameter to the constructor, or call bindEvent() on >> the object. So to bind a double click event in the grid to a method, >> you would do either one of these two: >> >> grd = dabo.ui.dGrid(self, OnGridMouseLeftDoubleClick=self.onGrid2Click) >> >> -or- >> >> grd = dabo.ui.dGrid(self) >> grd.bindEvent(dEvents.GridMouseLeftDoubleClick, self.onGrid2Click) >> >> -followed by- >> >> def onGrid2Click(self, evt): >> [you event code goes here] >> >> >> -- Ed Leafe >> -- http://leafe.com >> -- http://dabodev.com > When I design a class and want to bind an Event (to the class) do I bind it as > self.Form.bindEvent(dEvent,????, _function) since I don't have an instance of > the class? IOW how can I bind an event to my class from within the class? >
You are probably on the right track, but probably confusing yourself. You probably don't want to bind to the class. you probably want code in your class definition to bind to an instance of the class, which is generally what self references. A class is actually an object, and you can call it's methods and stuff, but you probably don't want to. probably, Carl K _______________________________________________ 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/dabo-users/[EMAIL PROTECTED]
