B4J Question Array of buttons

Discussion in 'B4J Questions' started by wheable, Nov 6, 2019.

  1. wheable

    wheable New Member Licensed User

    I have an array of 24 buttons . If I give them identical event names in designer can I handle their click events in a single event handler . If so how do I pass the name of the button to this event handler so it can tell which button generated the event ?

    Any help gratefully received
     
  2. stevel05

    stevel05 Expert Licensed User

    You don't need to pass the name, the keyword Sender will point to the object (button) that raised the event so inside the click event:
    Code:
    Dim B As Button = Sender
    Log(B.Text)
    Then B will point to the button that raised the event.
     
    Last edited: Nov 7, 2019
    Erel and DonManfred like this.
  3. Erel

    Erel Administrator Staff Member Licensed User

  4. wheable

    wheable New Member Licensed User

    Thanks, Works perfectly. I'm setting the 'tag' property to uniquely identify the button.
     
    Jorge M A likes this.
  5. wheable

    wheable New Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice