Enter Key to Select Item in List Box? - Forum

Forum Navigation
You need to log in to create posts and topics.

Enter Key to Select Item in List Box?

This seems like pretty standard behavior, but I can't find a way to make the Enter key select the highlighted item in a listbox.

I have the code working with a dbl-click action, but I'd like the same code/subroutine to execute if the enter key is pressed on an item.

Am I missing something?

Create a button outside the work area with an INTRO shortcut. Assign the action
If "[FocusedObject]" "=" "YourListBox"
GoSub "Subrutine of dbl-click"
Endif

CN_Iceman and vwatson have reacted to this post.
CN_Icemanvwatson

Thanks. By INTRO shortcut, you just meant the shortcut key? That's what I did, and it works. :)

wait wait wait.... how did you set a button to have Enter be the shortcut key????? And whats an "INTRO shortcut"?? I see everything BUT the Enter key as a possible shortcut key in the dropdown list!

I added the code indicated by rasl in the actions section of a button, and set the button off the page.

Then in the General section, for Shortcut Key, Enter isn't listed, but I pressed the Enter key and it picked that key up.

It seems like an unorthodox approach, but it works. Not sure why the Enter key functionality wasn't built into the listbox.

CN_Iceman has reacted to this post.
CN_Iceman

whoah..... in years I have never thought to just hit the enter key.... mind blown lol

Query: Will not the shortcut key in the general section of the ListBox achieve the results you're looking for?

However, as I write this, I do see an advantage to a button outside the work area when you want the Enter key to perform different actions depending on what object is in focus (or not in focus). Nice.