Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 82913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:41:29+00:00 2026-05-10T21:41:29+00:00

I’ve tried my best and cannot figure out what happened here. It worked fine

  • 0

I’ve tried my best and cannot figure out what happened here. It worked fine in Delphi 4. After upgrading to Delphi 2009, I don’t know if this is the way it is supposed to work, or if it’s a problem:

This is what my program’s menu looks like in Design Mode under Delphi 2009:

enter image description here

Notice that every word in the Main Menu and the File submenu have one letter underlined. It is supposed to be like this. This underlined letter is called the Accelerator Key and is standard in Windows applications so that you can use the Alt-key and that letter to quickly select the menu item and then submenu item with the keyboard rather than with your mouse.

You get them this way by using the ‘&’ character as part of the caption of the item, for example: Save &As…

When I run my application, and use the mouse to open the File menu, it looks like this:

enter image description here

The characters are underlined in the main menu, but are not underlined in the File menu.

If instead, I use the Alt-F key to open up the File submenu, then it looks correct like this:

enter image description here

and all the Accelerator Key letters are properly underlined.

I’ve played with the AutoHotKeys option but that’s not the problem.

Has someone encountered this problem before? Is the example in the 2nd image correct behavior that I don’t know of? Or is there some option or coding mistake that I might have missed?


Nov 2009 (one year later): mghie seems to have got to the root of this and figured out the problem. See his accepted answer below.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:41:29+00:00Added an answer on May 10, 2026 at 9:41 pm

    There is a standard Windows setting (under display properties) to normally hide those accelerators unless the Alt key is held down. That would explain why opening the menu with Alt+F10 shows them for you. Maybe that’s the cause?

    [EDIT]: No, it’s not. I just tried, and a simple TForm with a menu item shows the accelerator, but as soon as I add a TImageList and set the ImageIndex of the single menu item, or simply set OwnerDraw to true, then the accelerator underline disappears. I guess that really is a bug in the VCL.

    BTW, this is on Windows XP.

    Workaround:

    I have debugged this using Delphi 2009 on Windows XP 64, and the root cause for the missing accelerators seems to be that Windows sends WM_DRAWITEM messages with the ODS_NOACCEL flag set, which it shouldn’t if the system is set to show accelerators at all times. So you could say that it is not a VCL bug, but a Windows problem which the VCL does not work around.

    However, you can work around it in your own code, you just need to reset the flag before passing the message to the VCL. Override the window proc

    protected   procedure WndProc(var Message: TMessage); override; 

    like so:

    procedure TYourForm.WndProc(var Message: TMessage); const   ODS_NOACCEL = $100; var   pDIS: PDrawItemStruct;   ShowAccel: BOOL; begin   if (Message.Msg = WM_DRAWITEM) then begin     pDIS := PDrawItemStruct(Message.LParam);     if (pDIS^.CtlType = ODT_MENU)       and SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, @ShowAccel, 0)     then begin       if ShowAccel then         pDIS^.itemState := pDIS^.itemState and not ODS_NOACCEL;     end;   end;   inherited; end; 

    This is demonstration code only, you should not call SystemParametersInfo() every time a WM_DRAWITEM message is received, but once at program start, and then every time your program receives a WM_SETTINGCHANGE message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
I've got a string that has curly quotes in it. I'd like to replace
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.