1
votes

I'm using delphi 2009 and have created a popup menu.

object PopupMenu1: TPopupMenu
  object lmm1: TMenuItem
    Caption = 'lm/m'#178
  end
end

as soon as i have a "²" in a popup menu, it'll appear as "lm/m²(L)". using maManual for AutoHotKeys doesn't help...it still appears the same way. it's like hotkeys because each menu item gets a new one.

"lm/m² (L)" "m/m² (M)" "am/m² (N)" "bm/m² (O)"

must i use "lm/m2" instead of "lm/m²" if i want the (L) to go away?

used internationally, i'd still expect the "²" would be displayed properly.

thank you for your help!

2
Not sure since I browsed menus.pas of D2007, but it looks like the VCL is mistaking '²' with a lead byte (nested procedure 'InsertHotkeyFarEastFormat').Sertac Akyuz
I think that Sertac is on the right lines here. What character exactly is put in the string? This is a two byte character string and you have specified just #178. I'd want to investigate that aspect to see what is happening. Also worth debugging through the source to see what goes on.mj2008
thank you, guys! i found that the TPopupMenu.AutoHotKeys had to be set to maManual. i had tried that with the menu item itself but it clearly needed to be in the TPopupMenu. maybe Sertac could put that in as an answer so he can get the points!X-Ray
What I commented on is rather about why it behaved this way when 'AutoHotkeys' was 'maAutomatic'. In fact, like 'mj2008' I'm still curious about it.. Anyway, your resolution is different, IMHO it would be better if you provide the answer and accept it. :)Sertac Akyuz

2 Answers

2
votes

here's the solution i devised after studying/debugging the source of the TMenuItem.InternalRethinkHotkeys and TMenuItem.GetAutoHotkeys:

object PopupMenu1: TPopupMenu
  Left = 184
  Top = 272
  object MenuItem1: TMenuItem
    AutoHotkeys = maManual
    Caption = 'lm/m'#178
  end
end
0
votes

The AutoHotKeys property applies to keyboard accelerators when the ALT key is held down. What you are seeing is the TMenuItem.ShortCut property at work instead. Make sure it is set to scNone for any item you do not want "(#)" to appear on.