[Lazarus] TAction and Short-cut conflicts

R.Smith ryansmithhe at gmail.com
Mon May 25 23:37:36 CEST 2020


 > I also noticed that it reports Alt+C (i.e. accelerators, when some 
caption is "_Cut" with underlined _C_).

 > V.


Indeed, I did not mention this in the initial post because of TLDR; 
fears (though I would in the bug report, but the jury is still out on if 
this is even a bug) - thank you for bringing it up.

I think if the shortcut is a in-menu-only shortcut it should still be a 
conflict perhaps, but the extended quirk on this is that sometimes I use 
items with & in the name, (Like - actCompany.Caption:='Lyle & Sons.') 
but I don't want it to show as a shortcut (or for it to BE a shortcut).

No problem, just escape it the usual way: actCompany.Caption:='Lyle && 
Sons.'

But now, that adds a shortcut conflict to the list also, because the 
shortcut analyzer does not interpret the escaping - I assume.

For anyone else wishing to test - Just create a new Form app and copy 
the code between ======= lines below, and paste onto your form.
Then go to menu editor, on any item Right-click --> Shortcuts --> 
Resolve shortcut conflicts.

There are only 2 shortcuts used and they differ, so there are Zero 
conflicts here, but the Analyzer shows no less than 6 conflicts.

[ Note1: This code has no actual shortcuts assigned to any Menu-Item. 
Only the TActions have shortcuts, and they differ. ]
[ Note2: Shortcuts 16458 & 16459 are not special, they're simply 
"Ctrl+J" & "Ctrl+K", chosen arbitrarily.]

==================================

object ActionList1: TActionList
   left = 85
   top = 112
   object Action1: TAction
     Caption = 'Action1'
     ShortCut = 16458
   end
   object Action2: TAction
     Caption = 'Jack && Jill'
     ShortCut = 16459
   end
end
object pu1: TPopupMenu
   left = 32
   top = 64
   object MenuItem1: TMenuItem
     Action = Action1
   end
   object MenuItem2: TMenuItem
     Action = Action2
   end
end
object pu2: TPopupMenu
   left = 152
   top = 64
   object MenuItem3: TMenuItem
     Action = Action1
   end
   object MenuItem4: TMenuItem
     Action = Action2
   end
end

=========================



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200525/a8036fdc/attachment.html>


More information about the lazarus mailing list