Capturing mouse event in uiListboxItemClicked method

Home Forums Development Change requests Capturing mouse event in uiListboxItemClicked method

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #68879
    goodweather
    Participant
    • Topics: 45
    • Replies: 550
    • Total: 595
    • ★★★

    Hi Atom,
    I need to capture the event on Item clicked in a uiListBox (for example, Left or Right mouse buttons).

    I first used the OnMouseDown method but that one is reacting even when the user is just using the scrollbar. Is there a way to isolate the click on an item?
    Otherwise, this method is good as it provides the event object that I can use to know which button is pressed and I can retrieve the Item clicked by looking at getSelectedRow(0)

    Then I saw the OnItemClicked method. Direct access to the Item number BUT no indication of the event.
    I thought to use this method in combination with OnMouseDown.
    In this second case, I’m using the OnMouseDown to track the event and button and I use the OnItemClicked method for action depending on the item and button clicked.
    Issue: it seems that the OnItemClicked method is processed BEFORE OnMouseDown and thus i’m not getting satisfactory result. I saw this by doing some console outputs.

    So:

    • do you have some proposal to handle this with the current Ctrlr possibilities?
    • if not, would it be possible to add the event object as third argument of the OnItemClicked method?

    Thx in advance!

    #68890
    goodweather
    Participant
    • Topics: 45
    • Replies: 550
    • Total: 595
    • ★★★

    Found a work around to this issue…
    In the OnItemClicked method which is run first, I simply store the value, the modulator name and I set a variable bItemClicked to true.
    In the OnMouseDown method of the uiListbox component, I check whether the right or left mouse button has been pressed and if bItemClicked is true (if false then it means that the user clicked on the uiListbox for scrolling for example).
    If bItemClicked is true I execute some actions and I reset bItemClicked to false at the end.
    Works nice.

    Anyway, it would be nice (if possible) to have the mouse event directly accessible in the OnItemClicked method…

    #68902
    atom
    Keymaster
    • Topics: 159
    • Replies: 2945
    • Total: 3104
    • ★★★★★

    I missed that parameter to this callback i’ll add it asap. I’ll also have a look at other components so that they receive MouseClick objects.

    #68922
    goodweather
    Participant
    • Topics: 45
    • Replies: 550
    • Total: 595
    • ★★★

    Coooool Atom! Thx!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Change requests’ is closed to new topics and replies.
There is currently 0 users and 76 guests online
No users are currently active
Forum Statistics
Threads: 2,495, Posts: 17,374, Members: 77,605
Most users ever online was 12 on January 22, 2019 3:47 pm
Ctrlr