Source language: Translate to:

TIP: Double Click and Right click in Listbox

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

TIP: Double Click and Right click in Listbox

Postby dpayer » Tue Jun 04, 2013 11:39 am

When using a listbox, at times you want an action based on a double click or a right click. There is a circumstance where it may not work as you expect even though you double click or right click. This happens when the selection was not first clicked normally to high lite it. When you select the item by clicking once normally, you can do the right click or double click as expected.

Here is a work around to have a single action:
Code: Select all
If "[selectedlistboxitem]" "=" ""

At the top of the section for double click or right click, place the code above (using the correct variable for your listbox).

When you double click, the listbox will check the variable for the selected item. If empty, it will emulate a click and select the item. Then it will enact the code you have for the right click or double click.

You may want to set the variable to be empty when done so it doesn't use a previously selected item even though you click something else.
David Payer
Des Moines, Iowa
User avatar
Posts: 1386
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 1 guest