mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 09:01:01 +02:00
LCL-GTK3: Fix TRadioGroup. It did not work at all. Issue #34396, patch from Anton Kavalenka.
git-svn-id: trunk@59262 -
This commit is contained in:
parent
27955d5237
commit
82083bfa92
@ -22,11 +22,13 @@ unit gtk3widgets;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Controls, Graphics, Dialogs, Forms, StdCtrls, ComCtrls, Menus,
|
Classes, SysUtils, types, math,
|
||||||
types,
|
// LCL
|
||||||
LCLType, LCLProc, LMessages, LCLMessageGlue, LCLIntf,
|
Controls, StdCtrls, ExtCtrls, ComCtrls, Graphics, Dialogs, Forms, Menus, ExtDlgs,
|
||||||
|
Spin, CheckLst, LCLType, LCLProc, LMessages, LCLMessageGlue, LCLIntf,
|
||||||
|
// GTK3
|
||||||
LazGtk3, LazGdk3, LazGObject2, LazGLib2, LazCairo1, LazPango1, LazGdkPixbuf2,
|
LazGtk3, LazGdk3, LazGObject2, LazGLib2, LazCairo1, LazPango1, LazGdkPixbuf2,
|
||||||
gtk3objects;
|
gtk3objects, gtk3procs, gtk3private, Gtk3CellRenderer;
|
||||||
|
|
||||||
type
|
type
|
||||||
TByteSet = set of byte;
|
TByteSet = set of byte;
|
||||||
@ -680,8 +682,10 @@ type
|
|||||||
{ TGtk3RadioButton }
|
{ TGtk3RadioButton }
|
||||||
|
|
||||||
TGtk3RadioButton = class(TGtk3CheckBox)
|
TGtk3RadioButton = class(TGtk3CheckBox)
|
||||||
|
private
|
||||||
protected
|
protected
|
||||||
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
function CreateWidget(const Params: TCreateParams):PGtkWidget; override;
|
||||||
|
procedure InitializeWidget; override;
|
||||||
public
|
public
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -789,8 +793,8 @@ type
|
|||||||
function Gtk3WidgetEvent(widget: PGtkWidget; event: PGdkEvent; data: GPointer): gboolean; cdecl;
|
function Gtk3WidgetEvent(widget: PGtkWidget; event: PGdkEvent; data: GPointer): gboolean; cdecl;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses Spin, gtk3int, gtk3procs, gtk3private, Gtk3CellRenderer, ExtDlgs, math,
|
|
||||||
CheckLst;
|
uses gtk3int;
|
||||||
|
|
||||||
function Gtk3EventToStr(AEvent: TGdkEventType): String;
|
function Gtk3EventToStr(AEvent: TGdkEventType): String;
|
||||||
begin
|
begin
|
||||||
@ -6258,8 +6262,42 @@ end;
|
|||||||
{ TGtk3RadioButton }
|
{ TGtk3RadioButton }
|
||||||
|
|
||||||
function TGtk3RadioButton.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
function TGtk3RadioButton.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
||||||
|
var
|
||||||
|
w: PGtkWidget;
|
||||||
|
ctl, Parent: TWinControl;
|
||||||
|
rb: TRadioButton;
|
||||||
|
pl: PGsList;
|
||||||
begin
|
begin
|
||||||
|
if Self.LCLObject.Name='HiddenRadioButton' then
|
||||||
|
exit;
|
||||||
Result := PGtkWidget(TGtkRadioButton.new(nil));
|
Result := PGtkWidget(TGtkRadioButton.new(nil));
|
||||||
|
ctl := Self.LCLObject;
|
||||||
|
if Assigned(ctl) then
|
||||||
|
begin
|
||||||
|
Parent := ctl.Parent;
|
||||||
|
if (Parent is TRadioGroup) and (TRadioGroup(Parent).Items.Count>0) then
|
||||||
|
begin
|
||||||
|
rb := TRadioButton(Parent.Controls[0]);
|
||||||
|
if rb<>ctl then
|
||||||
|
begin
|
||||||
|
w := TGtk3RadioButton(rb.Handle).Widget;
|
||||||
|
pl := PGtkRadioButton(w)^.get_group;
|
||||||
|
PGtkRadioButton(Result)^.set_group(pl);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TGtk3RadioButton.InitializeWidget;
|
||||||
|
begin
|
||||||
|
if Self.LCLObject.Name='HiddenRadioButton' then
|
||||||
|
begin
|
||||||
|
exit;
|
||||||
|
{ PGtkRadioButton(Self.Widget)^.set_group(nil);
|
||||||
|
// PGtkRadioButton(Self.Widget)^.set_inconsistent(true);
|
||||||
|
PGtkRadioButton(Self.Widget)^.set_visible(false);}
|
||||||
|
end;
|
||||||
|
inherited InitializeWidget;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk3CustomControl }
|
{ TGtk3CustomControl }
|
||||||
|
Loading…
Reference in New Issue
Block a user