View Issue Details

IDProjectCategoryView StatusLast Update
0034350LazarusPatchpublic2018-10-01 21:01
ReporterAnton Kavalenka Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Platformx86_64-linuxOSDebian 
Product Version1.9 (SVN) 
Summary0034350: patch: Make GTK3 menu radio group working
DescriptionPatch enables adding radio items into same group
TagsNo tags attached.
Fixed in Revisionr59191
LazTarget-
WidgetsetGTK 3
Attached Files

Activities

Anton Kavalenka

2018-09-28 12:15

reporter  

gtk3group.diff (1,194 bytes)   
Index: gtk3widgets.pas
===================================================================
--- gtk3widgets.pas	(revision 59174)
+++ gtk3widgets.pas	(working copy)
@@ -4293,6 +4293,10 @@
 end;
 
 function TGtk3MenuItem.CreateWidget(const Params: TCreateParams): PGtkWidget;
+var
+  ndx:integer;
+  pmenu:TMenuItem;
+  pl:PGsList;
 begin
   FWidgetType := [wtWidget, wtMenuItem];
   if MenuItem.Caption = cLineCaption then
@@ -4299,7 +4303,22 @@
     Result := TGtkSeparatorMenuItem.new
   else
   if MenuItem.RadioItem and not MenuItem.HasIcon then
-    Result := TGtkRadioMenuItem.new(nil)
+  begin
+    Result := TGtkRadioMenuItem.new(nil);
+    if Assigned(menuItem.Parent) then
+    begin
+      ndx:=menuItem.Parent.IndexOf(MenuItem);
+      if (ndx>0) then
+      begin
+        pMenu:=menuItem.Parent.Items[ndx-1];
+        if (MenuItem.GroupIndex>0) and (pMenu.GroupIndex=MenuItem.GroupIndex) then
+        begin
+          pl:=PGtkRadioMenuItem(TGtk3MenuItem(pMenu.Handle).Widget)^.get_group;
+          PGtkRadioMenuItem(Result)^.set_group(pl);
+        end;
+      end;
+    end;
+  end
   else
   if MenuItem.IsCheckItem or MenuItem.HasIcon then
     Result := TGtkCheckMenuItem.new
gtk3group.diff (1,194 bytes)   

Anton Kavalenka

2018-09-28 12:16

reporter  

laztest111.zip (129,573 bytes)

Juha Manninen

2018-09-30 13:33

developer   ~0111108

Applied, thanks.

Issue History

Date Modified Username Field Change
2018-09-28 12:15 Anton Kavalenka New Issue
2018-09-28 12:15 Anton Kavalenka File Added: gtk3group.diff
2018-09-28 12:16 Anton Kavalenka File Added: laztest111.zip
2018-09-30 13:30 Juha Manninen Assigned To => Juha Manninen
2018-09-30 13:30 Juha Manninen Status new => assigned
2018-09-30 13:33 Juha Manninen Fixed in Revision => r59191
2018-09-30 13:33 Juha Manninen LazTarget => -
2018-09-30 13:33 Juha Manninen Note Added: 0111108
2018-09-30 13:33 Juha Manninen Status assigned => resolved
2018-09-30 13:33 Juha Manninen Resolution open => fixed
2018-10-01 21:01 Anton Kavalenka Status resolved => closed