03-25-2014 09:12 AM
Hi all,
Using LV 2012...
I have a multi-column listbox containing a single column of text values. I am trying to set up the following functionality:
Right-clicking on an item will cause a runtime menu to open... user will select "Parameters" from the menu and a dialog containing parameters specific to the item will appear.
The runtime menu was easy. The problem is the listbox value (row) does not change with right-clicking alone. I currently have to left-click to change the value and then right-click for the menu. Any way to to change the value with right-clicking?
Thank you!
Charlie
Solved! Go to Solution.
03-25-2014 12:17 PM
Rather than changing the value, you can do something like this - use the Mouse Down? event for the listbox. Because it's a filter event, it should execute first (although you might need to place it at an earlier frame in the event structure). Use the coords from that event and call the Point to Row Column method on the listbox. This will give you the row, which you can now keep in a shift register. Don't discard the event, and this will cause the menu event to occur, where you can now use the row value from before.
03-25-2014 01:20 PM
Thank you!
I had tried this originally with the difference being that I was trying to filter for button = 1 to see if I would get the right mouse button instead of the left.
I also had the filter state after the user runtime state. I didn't know order made a difference.
Finally, to really improve the GUI feel, I had the returned ROW value write to the listbox VALUE of a property node in the filter state instead of writing it in the user runtime state. This is because the highlighting of the row wasn't changing right away.
Now as soon as you right click, the highlighting reflects the current row, and then the parameter dialog pops up.
Awesome solution. Thank you!
Charlie
03-25-2014 01:45 PM
Here is the final.. just to be complete.
-=Charlie=-
03-25-2014 05:13 PM
asuwish4 wrote:
I also had the filter state after the user runtime state. I didn't know order made a difference.
I'm not 100% sure that it does. As far as I know the cases in a case structure are checked in order until a match is found, and I seem to remember something about the same thing happening with event structures, but without proper documentation, it would just be an implementation detail.
I'm assuming some code can be written to check what the order is, but I never really had the need to do it. I am assuming that filter events, at least, are handled first regardless of where they are, but I haven't actually checked.