B4J Question [SOLVED] How to implement Right-Click on Toggle Button

Discussion in 'B4J Questions' started by GuyBooth, May 22, 2019.

  1. GuyBooth

    GuyBooth Active Member Licensed User

    I have several toggle buttons which when clicked raise a common event. This is done by setting their Event Name in the Designer to "tglState", and creating this event in the code:
    Code:
    Sub tglState_Click
        
    Dim TglBtn As ToggleButton
        TglBtn = 
    Sender
        … code 
    to process desired actions on this click event

    end sub
    The Toggle Button does not have "built-in" MouseEvent eventdata, such as would be available with a Label, but I need to be able to determine whether the Right or Left button was clicked and process accordingly.
    My efforts to apply a listener have so far been complicated, clumsy, and only work on individual ToggleButtons, not with this code using a "Sender".
    Is there a simple way to add a mouse event parameter to the Click event of a Toggle Button?
    If not, how do I add a listener to work with this event code that is common to several Toggle Buttons?

    [UPDATE] Ouch! Just found out that tglState_MouseClicked (Eventdata as MouseEvent) works and gives me what I need.
     
    Last edited: May 22, 2019
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