Link to home
Start Free TrialLog in
Avatar of Peter Kiers
Peter KiersFlag for Netherlands

asked on

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
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

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)
Avatar of Peter Kiers

ASKER

Ok, where can I find this component?
ASKER CERTIFIED SOLUTION
Avatar of Ferruccio Accalai
Ferruccio Accalai
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thnx, Peter Kiers.

500 points are comming to you...