Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Alt Key - & Menu Items

Posted on 2008-10-02
9
Medium Priority
?
275 Views
Last Modified: 2012-05-05
I notice that by default (windows behavior), a menu does not have its menu items (first Character) underlined for the Alt-F hot keys, UNTIL you press the Alt button.

When you move away from your application, to another application, the underlines go away, and when you move back, you have to hit the ALT button again.

Is there a flag, or winAPI call or something that can change this behavior - to keep it on at all times?

Or would i have to explicitly call a ALT Key press in my forms OnActivate  - if so, what is the best code to do this?

Thanks
0
Comment
Question by:geocoins-software
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 6

Expert Comment

by:rohypnol
ID: 22624424
They shortcuts may not display by default in XP but they still work (Alt+F still opens File if the caption of the menu item is &File). As you probably noticed, to make a key shortcut for a menu item, prefix that character with the & sign, so your menu items should look like: &File, &Edit, &Window, &Save, Save &as...
0
 
LVL 21

Expert Comment

by:ziolko
ID: 22624474
use SystemParametersInfo() with SPI_GETMENUUNDERLINES

ziolko.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 22624522
of course SPI_SETMENUUNDERLINES

ziolko.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 21

Accepted Solution

by:
ziolko earned 500 total points
ID: 22624669
this should do the trick:

type
  TBOOL = record
    fBoolean: Boolean;
    FDummy: array[0..2] of Byte;
  end;

procedure TForm1.Button9Click(Sender: TObject);
var setting: TBOOL;
begin
  SystemParametersInfo(SPI_GETMENUUNDERLINES, 0, @setting, 0);
  Memo1.Lines.Add(BoolToStr(setting.fBoolean, True));
  setting.fBoolean := True; //False
  SystemParametersInfo(SPI_SETMENUUNDERLINES, 0, Pointer(setting), 0);
end;

True means that it will be always underlined, False means only when Ctrl key is pressed.

ziolko.
0
 

Author Comment

by:geocoins-software
ID: 22624679
ziolko,  what is the full call

 SystemParametersInfo(SPI_SETMENUUNDERLINES, ?,?,?)

Thanks
0
 

Author Comment

by:geocoins-software
ID: 22624707
Someone (Norrit) on DelphiPages just explained to me:

"This is default windows behaviour...

Right Click the desktop and choose [properties] [appearance] [Effects]
This feature is checked by default, which explains your behaviour..."


however, I will awards the points to first person who shows how to do this via code...

thanks
0
 
LVL 21

Expert Comment

by:ziolko
ID: 22624802
>>however, I will awards the points to first person who shows how to do this via code...
see my last comment, however I've noticed that change takes affect after first press of Ctrl button

ziolko.
0
 
LVL 21

Expert Comment

by:ziolko
ID: 22624810
and if you want make it system wide you have to use SPIF_UPDATEINIFILE or SPIF_SENDCHANGE instead of 0 as last param

ziolko.
0
 

Author Closing Comment

by:geocoins-software
ID: 31502379
THANKS!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question