|
-
Aug 29th, 2001, 01:36 AM
#1
Thread Starter
Member
select first item in a popup menu
Hello all,
I am displaying a popup menu using the TrackPopupMenu API function which works fine, except I want the first item in the menu to be the active item. In a standard application (Notepad for example) if you press Alt+F, the File menu pops up and the item 'New' is already the active item. Pressing down on the keyboard from that point moves to the next item ('Open' in this case). However when I display a menu via TrackPopupMenu, no item is selected by default. I can set the flags on the first item in the menu to contain MFS_HILITE which makes it look right, only you have to press the down arrow twice before it moves to the next item. All the MFS_HILITE flag does is make the button appear highlighted, it doesn't make it the active item. I know it can be done, Internet Explorer does it on its' fake toolbar/menubar thingy..then again, Microsoft does not always play fair . Sorry if this was a long post. Any help is most appreciated.
-
Aug 29th, 2001, 12:47 PM
#2
Lively Member
Try the following API function:
Declare Function SetMenuDefaultItem Lib "user32" Alias "SetMenuDefaultItem" (ByVal hMenu As Long, ByVal uItem As Long, ByVal fByPos As Long) As Long
Good luck!
-
Aug 29th, 2001, 02:42 PM
#3
Thread Starter
Member
Thank you for your reply but that won't work. SetDefaultMenuItem just changes the specified item to the "default" item meaning it appears in bold text. What I am trying to accomplish is to show a popup menu with the first item already selected so that when the user presses down on the keyboard, focus moves to the second item on the menu (as opposed to the first item which is what is happening now)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|