On Friday, December 03, 2010 06:03:30 am Iain Simpson wrote:
> 
> I now would like  to do two things :
> 
> a. click on any one of these buttons to take further action (eg display
> photo, file name etc.).
>       I tried (unsuccessfully) to bind an event to the button :
> 
>       #def clickMap(self):
>       #       dabo.ui.info(self.Caption)
>       #.
>       #.
>       #self.btn.bindEvent(dabo.dEvents.Hit,clickMap)

FYI: your link = 404

There are a couple of ways to associate a click for a button;

The easiest is:
dabo.ui.dButton(self, Caption = 'myBtn', OnHit = self.someMethod)

Where "self.someMethod" is where you handle the click.

next:

specialBtn = dabo.ui.dButton(self, Caption = 'myBtn')
specialBtn,bindEvent(dabo.dEvents.Hit, self.someMethod)

If I were doing something like this I would write at least two routines and 
one class.

class MySpecialBtn(dabo.ui.dButton):
   def initProperties(self):
        self.super()
       self.LogEvents = ['Hit',]

  def Hit(self,evt):
     #here I call my routines.
      self.routine2(evt)


def routine1(self, number_of_btns):
   # I have a way to create the buttons and assign a RegID.
   for num in range(number_of_btns):
      newbutton = MySpecialBtn(self)
      newbutton.RegID = 'btn_'+str(num)


def routine2(evt):
   #Ok I have the evt and can determine the button click from the evt
  btnregID = evt.EventObject.RegID
  #do some action as required
  do_something()

Of course this is just a general outline and may not work in your case.  But I 
hope it provides some help.

Johnf
   
   






_______________________________________________
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]

Reply via email to