Jump to content
  • Advertisement
Sign in to follow this  
Noods

Win32 menu text alignment

This topic is 3741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am adding menu text to my drop down menus so that users will know which quick keys to use. If you need an example of what I am trying to accomplish it is basically the Ctrl+O, Ctrl+N, Ctrl+S that you would find under the "File" menu of Internet Explorer or pretty much any "File" menu of any program. I am having a problem with alignment of the text. I am currently creating the menu structure via a resource file. However, the CTRL+ text is several pixels off on each line and it makes my menus look shabby. How can I go about aligning my menu text to match horizonally? Here is my menu setup.
IDC_SPRITEVIEWER MENU
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "&Open...   CTRL+O",                IDM_OPEN
        MENUITEM "&Close       CTRL+C",               IDM_CLOSE, GRAYED
        MENUITEM "E&xit          CTRL+X",             IDM_EXIT
    END
    POPUP "&Help"
    BEGIN
        MENUITEM "&About...",           IDM_ABOUT
    END
END

Share this post


Link to post
Share on other sites
Advertisement
Maybe you could try adding a \a inside the text's? According to MSDN, the \a aligns the rest of the text to the right.

EDIT: like this:

IDC_SPRITEVIEWER MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open...\aCTRL+O", IDM_OPEN
MENUITEM "&Close\aCTRL+C", IDM_CLOSE, GRAYED
MENUITEM "E&xit\aCTRL+X", IDM_EXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About...", IDM_ABOUT
END
END

Share this post


Link to post
Share on other sites
Quote:
Original post by Kippesoep
\a aligns everything to the right. Use \t instead.


From MSDN:
Quote:

The \a character aligns all text that follows it flush right to the menu bar or pop-up menu.

So, no, it doesn't align everything (unless you of course start the string with \a...)

Share this post


Link to post
Share on other sites
I meant the accelerator text itself is actually right-aligned, which it shouldn't be. The accelerators should be left aligned, but to the right.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!