View Issue Details

IDProjectCategoryView StatusLast Update
0036416LazarusWidgetsetpublic2019-12-22 03:08
ReporterChris RordenAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformRyzen 3900XOSUbuntuOS Version19.10
Product Version2.1 (SVN)Product Build62363 
Target VersionFixed in Version 
Summary0036416: GTK3: TColorDialog not implemented
DescriptionTColorDialog not provided for GTK3
Steps To ReproducePlace TColorDialog on Form, call
  if not ColorDialog1.execute then exit;
Run as QT5 (works), GTK2 (works) and GTK3 (no dialog shown).
TagsNo tags attached.
Fixed in Revision
LazTarget
WidgetsetGTK 3
Attached Files

Activities

Anton Kavalenka

2019-12-11 16:31

reporter   ~0119755

For reference: https://developer.gnome.org/gtk3/stable/GtkColorChooserDialog.html

CudaText man

2019-12-19 17:00

reporter   ~0119956

First steps
gtk3/gtk3wsdialogs.pp
  TGtk3WSColorDialog = class(TWSColorDialog)
  protected
    class procedure SetCallbacks(const AGtkWidget: PGtkWidget; const AWidgetInfo: TGtk3Dialog); virtual;
  published
    class function CreateHandle(const ACommonDialog: TCommonDialog): THandle; override;
    class procedure ShowModal(const ACommonDialog: TCommonDialog); override;
  end;
....

class function TGtk3WSColorDialog.CreateHandle(const ACommonDialog: TCommonDialog): THandle;
var
  Widget: PGtkWidget;
begin
  Widget := gtk_color_chooser_dialog_new(PChar(ACommonDialog.Title), nil);
  Result := THandle({%H-}PtrUInt(Widget));
end;

class procedure TGtk3WSColorDialog.ShowModal(const ACommonDialog: TCommonDialog);
var
  Dlg: PGtkColorChooser;
  ColorValue: TGdkRGBA;
begin
  Dlg := PGtkColorChooser(ACommonDialog.Handle);
  ColorValue := TColortoTGdkRGBA((ACommonDialog as TColorDialog).Color);
  gtk_color_chooser_set_use_alpha(Dlg, False);
  gtk_color_chooser_set_rgba(Dlg, @ColorValue);
  gtk_widget_show(PGtkWidget(Dlg));
  {
  gtk_color_chooser_get_rgba(Dlg, @ColorValue);
  (ACommonDialog as TColorDialog).Color := TGdkRGBAToTColor(ColorValue);
  }
end;


gtk3/gtk3wsfactory.pas

function RegisterColorDialog: Boolean; alias : 'WSRegisterColorDialog';
begin
  RegisterWSComponent(TColorDialog, TGtk3WSColorDialog);
  Result := True;
end;

Zeljan Rikalo

2019-12-19 17:21

developer   ~0119957

That's bad. Gtk3 widget should not be exposed to LCL as handle

Issue History

Date Modified Username Field Change
2019-12-09 17:36 Chris Rorden New Issue
2019-12-11 16:31 Anton Kavalenka Note Added: 0119755
2019-12-19 17:00 CudaText man Note Added: 0119956
2019-12-19 17:21 Zeljan Rikalo Note Added: 0119957