View Issue Details

IDProjectCategoryView StatusLast Update
0015245LazarusWidgetsetpublic2010-03-08 11:45
Reportercobines Assigned ToZeljan Rikalo  
Status closedResolutionfixed 
Product Version0.9.29 (SVN) 
Summary0015245: Grouping menu items as RadioItems doesn't work in main menu
DescriptionI create a menu and give each item following properties:
- AutoCheck = True
- RadioItem = True
- GroupIndex = 1

This should only allow checking one item within a group. It works as intended if used in TPopupMenu, however it doesn't work in TMainMenu.

I checked this on Linux/QT.
In Linux/GTK2 and Win32 widgetsets it works as intended.

Also, there is one inconsistency I found between GTK2 and QT in TPopupMenu. On GTK2 after the program starts the first item of a group is already automatically checked. This is not happening in QT. I haven't checked how it works on Win32.

Sample program is attached.
TagsNo tags attached.
Fixed in Revision23861
Attached Files


related to 0018057 closedPaul Ishenin Make popup menu items with GroupIndex =0 working as radio items 


2009-12-03 12:01


qt_radioitem.tar.bz2 (1,602 bytes)

Anton Kavalenka

2009-12-03 12:44

reporter   ~0032688

BTW in Delphi 0 is the valid group index.
In LCL I have to set GroupIndex >0 to make grouping work.

Zeljan Rikalo

2009-12-03 13:00

developer   ~0032689

This bug is because we have not QActionGroup in our C bindings yet.
QActionGroup can set exclusive mode (and show RadioItems instead of CheckBoxItems).
I'll ask Den if he can add it to bindings, or I have to find another approach to fix this problem.

Anton Kavalenka

2009-12-03 13:37

reporter   ~0032690

Last edited: 2009-12-03 13:39

In win32 1-st item in menu is not automatically checked.
In gtk2 both menus on startup have 1-st item checked.

Zeljan Rikalo

2009-12-03 14:58

developer   ~0032692

In qt too (but C++) when we use QActionGroup, which is unavailable currently in our bindings.I've sent message to Den to include missing class.

Zeljan Rikalo

2009-12-04 16:44

developer   ~0032722

Ok, this almost finished (but not commited yet, since I must wait until Den prepare 1.73 bindings from 1.73RC).
I'm just wondering what todo with those widgetset diffs like Anton Kavalenka mentioned.
Should we check always first radio item if there's no checked items, or leave it as it is on windows (win32) ?


2009-12-06 10:29

reporter   ~0032742

The same inconsistency is with normal radio buttons:
- on Win32, QT first button is not checked
- on GTK2 first button is checked

On GTK2 setting Checked=False for all radio buttons in a group is not possible, but it is allowed on Win32 and QT (unless using TRadioGroup). This might be a GTK2 behaviour that it doesn't allow a group without an item selected.

I propose that menu radio items are done the same way as radio buttons - the first item is not automatically selected, unless specifically Checked=True is set for this item.

Zeljan Rikalo

2009-12-06 11:20

developer   ~0032745

ok, then I'll do it in that way, but what's the meaning of Default property in TMenuItem ?


2009-12-06 16:42

reporter   ~0032753

I think Default means the item should displayed distinctively from other items (for example in bold font). But it doesn't seem to do anything in GTK2 or QT. It is probably used with popup menus, when a default action on an object should be highlighted.

Zeljan Rikalo

2010-03-07 11:48

developer   ~0035006

Test and close if ok.


2010-03-08 11:45

reporter   ~0035039

Thanks. Works like a charm.

Issue History

Date Modified Username Field Change
2009-12-03 12:01 cobines New Issue
2009-12-03 12:01 cobines File Added: qt_radioitem.tar.bz2
2009-12-03 12:01 cobines Widgetset => QT
2009-12-03 12:36 Zeljan Rikalo Status new => assigned
2009-12-03 12:36 Zeljan Rikalo Assigned To => Zeljan Rikalo
2009-12-03 12:37 Zeljan Rikalo LazTarget => 0.9.30
2009-12-03 12:44 Anton Kavalenka Note Added: 0032688
2009-12-03 13:00 Zeljan Rikalo Note Added: 0032689
2009-12-03 13:00 Zeljan Rikalo Status assigned => acknowledged
2009-12-03 13:37 Anton Kavalenka Note Added: 0032690
2009-12-03 13:39 Anton Kavalenka Note Edited: 0032690
2009-12-03 14:58 Zeljan Rikalo Note Added: 0032692
2009-12-04 16:44 Zeljan Rikalo Note Added: 0032722
2009-12-04 16:44 Zeljan Rikalo Status acknowledged => feedback
2009-12-06 10:29 cobines Note Added: 0032742
2009-12-06 11:20 Zeljan Rikalo Note Added: 0032745
2009-12-06 16:42 cobines Note Added: 0032753
2010-03-07 11:48 Zeljan Rikalo Fixed in Revision => 23861
2010-03-07 11:48 Zeljan Rikalo Status feedback => resolved
2010-03-07 11:48 Zeljan Rikalo Resolution open => fixed
2010-03-07 11:48 Zeljan Rikalo Note Added: 0035006
2010-03-08 11:45 cobines Status resolved => closed
2010-03-08 11:45 cobines Note Added: 0035039
2010-11-26 11:48 Vincent Snijders Relationship added related to 0018057