Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

Force persistent underscores in MainMenu, like Word has.

Hi,

I have received from my previous question an url about how to force
underscores in the MainMenu.  This is the link:

http://www.tek-tips.com/viewthread.cfm?qid=1489404&page=22

I have read it, and came to the conclussion that I have set this procedure below to every menu-item I got!!!

procedure TMainForm.AdvancedDrawItem(Sender: TObject; ACanvas: TCanvas; ARect: TRect; State: TOwnerDrawState);
begin
 if odnoAccel in State then      // this proc to force underscore on menu items
  State := State - [odnoAccel];
 TMenuItem(Sender).OnAdvancedDrawItem := nil;
 DrawMenuItem(TMenuItem(Sender), ACanvas, ARect, State);
 TMenuItem(Sender).OnAdvancedDrawItem :=  AdvancedDrawItem;
end;

So I have 20 menu-items, so I have to add 20 times AdvancedDrawItem-procedure.
Isn't there a better way?

Peter
0
peterkiers
Asked:
peterkiers
  • 2
  • 2
1 Solution
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
mmm, if you could replace your TMainmenu with a TJvMainMenu you shoul solve it without using any AdvancedDrawItem procedure, as TJvMainMenu already shows shortcuts directly without pressing any alt key (using of course the '&' in the caption)
0
 
peterkiersAuthor Commented:
Ok, where can I find this component?
0
 
Ferruccio AccalaiSenior developer, analyst and customer assistance Commented:
It's in JVCL library, but if you don't have it already installed maybe is not so convenient to install the whole library just to use that component.

First give a try to this, reported at this link
http://stackoverflow.com/questions/280247/menu-accelerator-keys-not-showing-up-delphi-2009
0
 
peterkiersAuthor Commented:
Thnx, Peter Kiers.

500 points are comming to you...
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now