News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

& is ineffective in underlining menuitem

Started by allynm, December 30, 2009, 11:20:35 PM

Previous topic - Next topic

allynm

Hi everyone-

This is a trivial problem, but annoying...  I have placed & in front of menuitems like this:

                             "&Help"    but I can't get the H (or anything else) to display with an underline.

Maybe I'm misunderstanding how to use the & but I have been thru a couple of API books and I think I'm doing it OK.  One theory I had was that to get the & to do its intended action there needed to be an accelerator with it. 

Any ideas?

Thanks,

Mark Allyn

jj2007

Mark,
I just tested it with RichMasm: When I open the Format menu by moving the mouse over it, there are no underlines. If instead I press Alt T for opening the menu, I see them.
Which makes sense: If you work with the mouse, you don't need them.
So the answer is (most probably): "It's by design"(TM)

allynm

Hi JJ-

Thanks for the very fast response.  This is kind of an interesting problem in a small sort of way.  If you put double && inside the quoted menuitem text the one of the & is stripped off and the remaining one is printed along with the text.  So, the OS "sees" the ampersand, but doesn't do anything with it.  This is consistent with your theory about "by design"TM.   

So....in the ICZELION tutorials and in many other places these &'s show up and they don't do anything!  BTW, the reason I got interested in accelerators was because of that very fine piece of code you furnished the other day--"SetPixel".  In SetPixel you implemented the translateaccelerator function (which I had never seen).  So I put that into a little program I've been working on, and it works!!!  But, in the same SetPixel program you implemented a bunch of dynamic menus and each a couple of them have the same & in them.  They don't seem to do anything either....

Best regards and thanks

Mark


MichaelW

On my system, all menu access keys including those implemented in the SetPixel app appear normally with an underline. Perhaps you are seeing the effect of some system setting or some application that alters the UI behavior or its appearance.
eschew obfuscation

allynm

Hi MichaelW-

Maybe so.  But, if I go to EXCEL on this machine and open it up I see the underlines on menuitems and the accelerators work as they should.  Same OS. 

I'm puzzled.

Thanks,
Mark

sinsi

There is a windows setting, something like 'hide underlines until I press the alt key' (and we all know ms office has its own gui rules ::))
Light travels faster than sound, that's why some people seem bright until you hear them.

allynm

Hi Sinsi and everyone -

Sinsi is correct.  If I run the app and click on "Alt" all the underlines appear.  Thanks, Sinsi.  A stroke of genius.  How do I get the underlines to show up without hitting "alt"? 

Regards to all,

Mark

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

allynm

Hello Sinsi and all who have helped me,

Well, the answer is precisely given by the link Sinsi supplied.  I am running XP on this HP box and I went to Control Panel and followed the instructions given in the MS link.  Everything worked as it should.  I now have underlines below the chars identified by &. 

What can I say?  Deeply satisfying.

Thanks Sinsi,

Mark

sinsi

Yeah, xp hides them by default (after telling us for years to 'look for the underlined character for the alt-hotkey').
Too much clutter for the average mouse user I guess. Probably slows things down too, knowing ms code.

Found it under 'ease of access' in win7.

Glad to helpĀ  :U
Light travels faster than sound, that's why some people seem bright until you hear them.

MichaelW

A small point, keyboard accelerators and menu access keys are not the same thing. See Menu Access Keys and Menu Shortcut Keys here:

http://msdn.microsoft.com/en-us/library/ms647557(VS.85).aspx

eschew obfuscation