Detecting Select All in Listbox

How do you detect if the user has done a Select All (Cmd-A on Mac, Ctl-A on Win) on a ListBox? I tried this in the Change event:

if Keyboard.AsyncCommandKey Then If Keyboard.AsynckeyDown(&h00) Then SelectAll = True end if End If

The Command key gets detected but not the A key, probably because it usually is not pressed by the time Change fires.

The KeyDown event doesn’t help because it doesn’t fire when the Command button is pressed.

Subclass the listbox and add a menuhandler for EditSelectAll?

Check if the current control (control who have the focus) is your ListBox (the ListBox you want to check Select All) in Window EnableMenuItems ?

Thank you! I often don’t make the connection between menus and keystrokes.

Thanks Tim!

I know this is conversation is a bit old now but I had a similar problem - I wanted to know when a select all had been invoked because I wanted to stop the listbox’s change event running. The way I did it was to rename the default EditSelectAll menu handler to EditSelAll and I then had to handle it myself rather than the default action. It solved my problem, may give an easier solution to yours.

Jack