Results 1 to 20 of 20

Thread: [RESOLVED] Menu Item Question

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Resolved [RESOLVED] Menu Item Question

    How do I set the caption to bold on a menu submenu
    Last edited by jmsrickland; Nov 24th, 2015 at 12:23 AM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  2. #2
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: Menu Item Question

    Does this PSC entry answer it for you?

    http://www.planetsourcecode.com/vb/s...=8862&lngWId=1

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Menu Item Question

    If you are talking about a context menu that you created in VB, the PopupMenu command's final parameter will bold that menu item when it is displayed. Otherwise, APIs are likely needed as may be in Sam's link?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,238

    Re: [RESOLVED] Menu Item Question

    Its nice to see planetsourcecode.com is back online.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Menu Item Question

    I thought Sam's link would do the job but unfortunately, it doesn't work if the main menu is invisible

    I'm using this as a popupmenu so only the submenus are visible but it only appears to work as long as the main menu is visible

    EDIT: I tried leaving the .Caption blank and that works but the buttons are still on the menu bar so that approach is out. I then tried using a bitmap which also works but then once it is highlighted it looks ugly: blue and black background with white letters so again that approach is out.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #6
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,651

    Re: Menu Item Question

    Do you need more than 1 item in bold (that's bad programming standards)? If not just specify which one in the last parameter of PopupMenu like LaVolpe said.

    Otherwise, you're going to have to go so deep into subclassing that you'd be better off just making your own API popup menu (easier than subclassing, plus on Vista+ using pretty icons of any size is easy).

  7. #7
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Menu Item Question

    @JM. Bolded menu items indicate a shortcut for default menu. Per MSDN: "The default command is invoked when users double-click or select an object and press Enter." In other words, instead of right clicking on something, selecting the bolded popup menu item, the user can simply double click on it. Only 1 submenu item in the popup/context menu should ever be bolded; else you risk confusing your user.

    If this is indeed a context menu scenario you are describing, my first reply should work.

    P.S. non-visible menus/menuitems are created on demand in VB when you display them.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Menu Item Question

    Quote Originally Posted by LaVolpe View Post
    Bolded menu items indicate a shortcut for default menu. Per MSDN: "The default command is invoked when users double-click or select an object and press Enter." In other words, instead of right clicking on something, selecting the bolded popup menu item, the user can simply double click on it. Only 1 submenu item in the popup/context menu should ever be bolded; else you risk confusing your user.
    Exactly.

    But you have to consider a few things. People who drive using their feet on the steering wheel and hands on the pedals with mirrors rigged to see where they are going have no trouble creating bizarre user interfaces that ignore standards and guidelines. It's the old "I want it this way, screw the users who will be massively confused" approach to software development.

    It's similar to the old "I want the Enter key to do what the Tab keys does" sort of thing.

    If you have no clue how Windows UIs work you tend to get... "creative."

  9. #9

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Menu Item Question

    Quote Originally Posted by LaVolpe View Post
    @JM. Bolded menu items indicate a shortcut for default menu. Per MSDN: "The default command is invoked when users double-click or select an object and press Enter." In other words, instead of right clicking on something, selecting the bolded popup menu item, the user can simply double click on it. Only 1 submenu item in the popup/context menu should ever be bolded; else you risk confusing your user.

    If this is indeed a context menu scenario you are describing, my first reply should work.

    P.S. non-visible menus/menuitems are created on demand in VB when you display them.
    This is what I am doing:

    If you notice that when you right drag drop an item onto Windows Explorer it shows a popup menu displaying three choices:

    Copy Here
    Move Here
    Cancel

    Move Here is bold. If you don't select anything from the menu then no action is performed so I don't understand how it is the default. I know if you left drag and drop the item is moved to the target but not right drag - please explain you comment

    Also please explain:

    P.S. non-visible menus/menuitems are created on demand in VB when you display them

    You know you can make them non-visible at design time
    Last edited by jmsrickland; Nov 24th, 2015 at 11:16 AM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  10. #10
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    9,145

    Re: Menu Item Question

    "But you have to consider a few things. People who drive using their feet on the steering wheel and hands on the pedals with mirrors rigged to see where they are going have no trouble creating bizarre user interfaces that ignore standards and guidelines. It's the old "I want it this way, screw the users who will be massively confused" approach to software development."
    Sounds like a government application I've been testing!!!!!

  11. #11
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Menu Item Question

    Quote Originally Posted by dilettante View Post
    If you have no clue how Windows UIs work you tend to get... "creative."
    Or if you are the kind of individual who is more interested in the UI than the code behind it.
    I've seen many a web developer trying to scratch that itch.
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  12. #12
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Menu Item Question

    Move Here is Bold. If you don't select anything from the menu then no action is performed so I don't understand how it is the default - please explain
    You never described how you were using the popup menu, didn't give us any context.

    So, if no action occurs without clicking on a menu item, then I don't really understand a need to bold something.

    As far as default menu commands go, a simple scenario is one like this:
    1) You have an icon that can perform multiple actions based on a popup/context menu
    2) The most common menu option would be a 'Copy' command
    3) Instead of forcing user to right click & select 'Copy', you can add code behind the icon control to copy when double clicked
    4) When right clicked, you'd display all the options available, but include 'Copy' as bold so users know that double click = 'Copy'
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  13. #13

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Menu Item Question

    Quote Originally Posted by LaVolpe View Post
    You never described how you were using the popup menu, didn't give us any context.

    So, if no action occurs without clicking on a menu item, then I don't really understand a need to bold something.

    As far as default menu commands go, a simple scenario is one like this:
    1) You have an icon that can perform multiple actions based on a popup/context menu
    2) The most common menu option would be a 'Copy' command
    3) Instead of forcing user to right click & select 'Copy', you can add code behind the icon control to copy when double clicked
    4) When right clicked, you'd display all the options available, but include 'Copy' as bold so users know that double click = 'Copy'
    I don't either but it is what Explorer does so I'm doing the same thing

    What are you saying double click? Double click on what? Double click on the menu selection? I don't understand


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  14. #14
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Menu Item Question

    I don't either but it is what Explorer does so I'm doing the same thing
    Ah, I see. Yes, Windows Explorer doesn't make sense in that respect does it, other than letting you know what would've happened if your left-dragged vs. right-dragged? Now if after you showed the context menu, you actually highlighted the menu item & set focus to the menu so the user could simply hit the enter key -- that'd make more sense (but maybe dangerous for users?).
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  15. #15
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,651

    Re: Menu Item Question

    Explorer lets you know the default because that's useful information. Contrary to what jms says, there are many circumstances where copy or create shortcut is bolded on a right drag menu instead of move, with corresponding different default left drag behavior. If I'm not sure what's going to happen with left drags, I always check which item is bolded on the right click menu first.

  16. #16
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Menu Item Question

    If I'm not sure what's going to happen with left drags
    If most apps do what Explorer does, sure seems that right-dragging will highlight which option would occur if you left dragged. And it appears so. Is this really useful information for the user? Six of one, half-dozen of the other. If you consistently right-dragged files from one folder to another folder on different drives, you'd get the 'Copy' option bolded. Well, if you adjusted your behavior, knowing that 'Copy' always occurs, then you might start left-dragging & that's where the danger occurs: behavior modification leaning towards quick & easy. Now that one is in that mode, they left drag between folders on the same drive. Now the file was moved vs copied & hopefully user realized it.

    But in any case really. The default option, relating to menus, is really app-specific. If one is completely familiar with the different options and how/when they apply, they can use the shortcut (left-drag, double click, whatever) vs displaying a context menu & selecting from that. If one wants to replicate Explorer behavior for their app, then so be it, but is that behavior consistent across all operating systems? If not, other decisions should be made. Better, IMO, to define your app's own behavior (even if it duplicates some other app's behavior by design or accident)

    P.S. @JM. Just to be sure, you do realize that when dragging (right or left), the default (bolded) option can change depending on the source & destination and/or if the control/shift key is held down.
    Last edited by LaVolpe; Nov 24th, 2015 at 02:24 PM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  17. #17

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Menu Item Question

    Quote Originally Posted by LaVolpe View Post
    P.S. @JM. Just to be sure, you do realize that when dragging (right or left), the default (bolded) option can change depending on the source & destination and/or if the control/shift key is held down.
    Yes, I am aware of this.

    All I am doing is to make my app have the look and feel of Windows Explorer so if WE does this and does that then that is how it will be with my app.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  18. #18
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,651

    Re: Menu Item Question

    So much work trying to simulate the look and feel of Explorer instead of just actually using Explorer... there's just no way with all the threads you've posted that your code isn't way more complex, lengthy, unstable, etc, than just the 2 API calls you were having trouble with.
    Last edited by fafalone; Nov 24th, 2015 at 08:29 PM.

  19. #19

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Menu Item Question

    Oh, well, what can I say.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  20. #20

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Menu Item Question

    Quote Originally Posted by LaVolpe View Post
    P.S. @JM. Just to be sure, you do realize that when dragging (right or left), the default (bolded) option can change depending on the source & destination and/or if the control/shift key is held down.
    Here's what I came up with by trying all the combinations. I really don't see the point to this at all:

    Code:
                             Same Dives                    Different Drives
    Action                   Effects                       Effects
    
    Left drag                Move                          Copy
    Left drag+Alt            Copy                          Copy
    Left drag+Ctrl           Copy                          Copy
    Left drag+Ctrl+Alt       Move                          Copy
    Left drag+Shift          Move                          Move
    Left drag+Ctrl+Shift     Copy                          Copy
    
    Right drag               Menu: Copy Move Cancel        Menu: Copy Move Cancel
    Right drag+Alt           No action                     No action
    Right drag+Ctrl          Menu: Copy Move Cancel        Menu: Copy Move Cancel
    Right drag+Ctrl+Alt      No action                     No action
    Right drag+Shift         Menu: Copy Move Cancel        Menu: Copy Move Cancel
    Right drag+Ctrl+Shift    Menu: Copy Move Cancel        Menu: Copy Move Cancel


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width