B4J Question ComboBox get Item only by left click

Rzimski

Member
Hi everyone,

I tried to get a value from my comboBox.
But it is very important that I only get the value by a left click and not with left or right click on my mouse.
By a button I have the event mouseClicked. With this eventData I´m able to confirm only the left click but how I cac do it by a comboBox or a menuItem?

Kind regards
 

LucaMs

Expert
Licensed User
Longtime User
I state that I do not know B4J, but I remember the example of Erel to create a DoubleClick effect: he used a transparent panel on a view.

Perhaps you could create a custom control (I do not know it, with B4J) using a button and a listview or put a "node" invisible over the combo that intercepts the mouseClicked event.

(This could be a solution for my drag a TreeItem)
 
Last edited:
Upvote 0

IanMc

Well-Known Member
Licensed User
Longtime User
Ohh look! This works:
B4X:
Sub ComboBox1_MouseClicked (EventData As MouseEvent)
    Log(EventData)
End Sub
Now how do we filter out PRIMARY and SECONDARY ?

Oh no :( it doesn't work when you actually click on one of the items in the ComboBox ... only when you click to make it drop down.

Is there a 'what was the last mouse button pressed' method?

erm this:
B4X:
Sub AnchorPane1_MouseClicked (EventData As MouseEvent)
    Log(EventData.PrimaryButtonDown)
End Sub
seems to return false with the occasional true... ah but PrimaryButtonPressed works :)

Can we do something with ComboBox1.ContextMenu ? as it states in intellisense:
'Gets or Sets the ContextMenu that will appear when the user Right-Clicks on the control'
and it seems to fire when you click on an item but if I Log it, it says 'Not Initialized' because I don't know what I'm doing :)

ah, no it doesn't, there are no events for ContextMenu.... foiled again
 
Last edited:
Upvote 0
Top