View Issue Details

IDProjectCategoryView StatusLast Update
0030808LazarusLCLpublic2019-05-23 19:04
ReporterZoë PetersonAssigned ToFelipe Monteiro de Carvalho 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionreopened 
Product Version1.7 (SVN)Product Build 
Target VersionFixed in Version 
Summary0030808: TMenuItem.OnClick doesn't work for submenu items
DescriptionWhen mousing over a menu item that shows a submenu its OnClick handler should be called. Sample project and patch included in zip
Steps To ReproduceExpand the attached zip and compile it with Cocoa and Carbon and compare the difference in behavior when mousing over the top-level menus to show their submenus. When mousing over the "Change" one the form background should change color.

Under Windows and Carbon, the background changes every time the mouse goes over the item to show the menu. Qt does too, but only if it's on a dropdown rather than a top-level menu item. The Gtk widgetset doesn't seem to support it at all, at least on Ubuntu with the detached menus.
Additional InformationThe attached patch wires the OnClick handler up to [NSMenuDelegate menuNeedsUpdate:] callback. That causes OnClick to be called, with two differences from the other widget sets:

1) OnClick is only called once per tracking session. That is, if you click into the menu and force it to drop down it will call it once, but then it won't call it again until you click away from the menu.

2) OnClick is called during keyboard hotkey handling.

NSMenuDelegate also has a menuWillOpen: callback that would work, and matches the existing widget sets better (OnClick is called on every mouse over, and isn't called for hotkey handling). Unfortunately, the documentation specifically says that you can not modify the menu in menuWillOpen, so it isn't useful for actually customizing it on demand. That's what we're using it for, so menuNeedsUpdate: is preferable, even with the caveats.
TagsNo tags attached.
Fixed in Revision61261
LazTarget-
WidgetsetCocoa
Attached Files

Activities

Zoë Peterson

2016-10-28 00:40

reporter  

SubMenu.OnClick.zip (1,842 bytes)

Felipe Monteiro de Carvalho

2017-03-12 22:30

developer   ~0098852

Thanks, applied

Zoë Peterson

2019-05-18 00:18

reporter   ~0116240

This was broken again in revision 61101. It's not clear what that revision was specifically fixing, so I can't offer an alternate patch

Dmitry Boyarintsev

2019-05-21 19:44

developer   ~0116308

please test and close if ok

Issue History

Date Modified Username Field Change
2016-10-28 00:40 Zoë Peterson New Issue
2016-10-28 00:40 Zoë Peterson File Added: SubMenu.OnClick.zip
2017-03-12 22:25 Felipe Monteiro de Carvalho Assigned To => Felipe Monteiro de Carvalho
2017-03-12 22:25 Felipe Monteiro de Carvalho Status new => assigned
2017-03-12 22:30 Felipe Monteiro de Carvalho Fixed in Revision => 54394
2017-03-12 22:30 Felipe Monteiro de Carvalho LazTarget => -
2017-03-12 22:30 Felipe Monteiro de Carvalho Note Added: 0098852
2017-03-12 22:30 Felipe Monteiro de Carvalho Status assigned => resolved
2017-03-12 22:30 Felipe Monteiro de Carvalho Resolution open => fixed
2019-05-18 00:18 Zoë Peterson Status resolved => assigned
2019-05-18 00:18 Zoë Peterson Resolution fixed => reopened
2019-05-18 00:18 Zoë Peterson Note Added: 0116240
2019-05-21 19:44 Dmitry Boyarintsev Status assigned => resolved
2019-05-21 19:44 Dmitry Boyarintsev Fixed in Revision 54394 => 61261
2019-05-21 19:44 Dmitry Boyarintsev Widgetset Cocoa => Cocoa
2019-05-21 19:44 Dmitry Boyarintsev Note Added: 0116308
2019-05-23 19:04 Zoë Peterson Status resolved => closed