View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0036942 | Lazarus | Widgetset | public | 2020-04-21 13:38 | 2020-09-25 22:21 |
Reporter | Chris Rorden | Assigned To | Juha Manninen | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Ryzen 3900X | OS | Ubuntu | ||
Product Version | 2.1 (SVN) | ||||
Summary | 0036942: GTK3: Anchor autosizing | ||||
Description | Anton's recent GTK3 patches have made huge strides in usability for many applications. I note a few outstanding issues. These can be seen with my MRIcroGL github project, but I provide a simpler project below to demonstrate: 1. TSpinEdit spinner width ignored for anchoring (e.g. "color" button should be to the left of the "width" spin edit. 2. Button size not accurate (note overlap for L/A/P/R buttons, though note improved if buttons have AutoSize := true 3. Toggling visibility of components can lead to errors: Press the "Options" button a few times to show/hide boxes: not that the "Lines" and "Cutout" group boxes overlap. This is fixed if the user interactively resizes the form. Perhaps hiding/showing components requires some resize/refresh call. Note: This issue is related to and extends issue 0036826 with a better example. If that issue is set to fixed, I will close it. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 63911 | ||||
LazTarget | - | ||||
Widgetset | GTK 3 | ||||
Attached Files |
|
related to | 0036826 | new | GTK3 AutoSize TCheckListBox | |
related to | 0037802 | closed | Juha Manninen | gtk3: Implement TextHint for TEdit |
|
|
|
Another strange and perhaps related issue in this project: when the gtk3 project first launches, the TTrackbars are frozen - the user can not move their position. Resizing the form allows the user to interact with these controls normally. |
|
About frozen trackbars - it looks like spinbuttons inside the gropbox think they are occupying the same places as trackbar. I my case the situation is even worse. See the spinbuttons (top-right corner), which have to be inside groupbox. Btw - they are handling mouse clicks, and update edits. Looks like GTK3 Fixed widget (which is used inside TGroupBox) does not care about child controls. |
|
I do hope you can resolve this. Thanks to your work (and others), a lot of GTK3 now works with Lazarus. But it is unclear how some of these details will get addressed. Your issue sounds like this: https://blog.gtk.org/2017/04/25/widget-hierarchies-in-gtk-4-0/ "complicated widgets in GTK+3 which don’t inherit from GtkContainer, e.g. GtkSpinButton or GtkSwitch. These never have real GtkWidget children. Consider, for example, the two clickable areas in a GtkSpinButton. I’m not calling them “buttons” here for a reason, since in GTK+3, they are not actual GtkButton instances, as GtkSpinButton is not a GtkContainer. Instead, GtkSpinButton has to work around that fact, and create two GdkWindows for the up/down areas and then render two icons in there" |
|
Looks like button autosizing problem was caused by incoherence between LCL and GTK3. The patch forces button constraint (as GTK3 button size can not be less than specified by theme) Also fixes the button click handler double delivery. As button "clicked" handler introduced, there is no need in default mouse processing. gtk3widgets.diff (1,034 bytes)
Index: lcl/interfaces/gtk3/gtk3widgets.pas =================================================================== --- lcl/interfaces/gtk3/gtk3widgets.pas (revision 63907) +++ lcl/interfaces/gtk3/gtk3widgets.pas (working copy) @@ -2649,6 +2649,7 @@ ARect: TGdkRectangle; ARgba: TGdkRGBA; i: TGtkStateType; + mh,nh,mw,nw:gint; begin FFocusableByMouse := False; FCentralWidget := nil; @@ -2671,6 +2672,13 @@ height := LCLObject.Height; end; FWidget^.set_allocation(@ARect); + + fWidget^.get_preferred_height(@mh,@nh); + fWidget^.get_preferred_width(@mw,@nw); + + LCLObject.Constraints.MinHeight:=mh; + LCLObject.Constraints.MinWidth:=mw; + end; LCLIntf.SetProp(HWND(Self),'lclwidget',Self); @@ -6562,6 +6570,8 @@ g_signal_connect_data(btn,'clicked', TGCallback(@TGtk3Button.ButtonClicked), LCLObject, nil, 0); + LCLObject.ControlStyle:=LCLObject.ControlStyle+[csClickEvents]; + FMargin := -1; FLayout := GTK_POS_LEFT; FSpacing := 2; // default gtk3 spacing is 2 |
|
I plan to test and apply this soon. A question: do you know why Lazarus IDE itself does not work when built for LCL-GTK3? I tested some weeks ago and IIRC it crashed at the start. |
|
I will look |
|
|
|
The patch is already applied earlier in 63911. Does it solve this issue? |
|
Yes, these lines fWidget^.get_preferred_height(@mh,@nh); fWidget^.get_preferred_width(@mw,@nw); LCLObject.Constraints.MinHeight:=mh; LCLObject.Constraints.MinWidth:=mw; |
|
Resolving. |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-04-21 13:38 | Chris Rorden | New Issue | |
2020-04-21 13:38 | Chris Rorden | File Added: overlap.png | |
2020-04-21 13:38 | Chris Rorden | File Added: overlap2.png | |
2020-04-21 13:38 | Chris Rorden | File Added: gtk3_autosize.zip | |
2020-04-21 13:48 | Chris Rorden | Note Added: 0122314 | |
2020-04-21 14:03 | Anton Kavalenka | Note Added: 0122317 | |
2020-04-21 14:03 | Anton Kavalenka | File Added: Здымак экрана, 2020-04-21 15-01-13.png | |
2020-04-21 14:05 | Anton Kavalenka | Note Edited: 0122317 | View Revisions |
2020-04-21 14:05 | Anton Kavalenka | Note Edited: 0122317 | View Revisions |
2020-04-21 16:26 | Juha Manninen | Relationship added | related to 0036826 |
2020-04-24 18:12 | Chris Rorden | Note Added: 0122385 | |
2020-09-23 15:22 | Anton Kavalenka | Note Added: 0125776 | |
2020-09-23 15:22 | Anton Kavalenka | File Added: gtk3widgets.diff | |
2020-09-23 15:22 | Anton Kavalenka | Note Edited: 0125776 | View Revisions |
2020-09-23 21:32 | Juha Manninen | Assigned To | => Juha Manninen |
2020-09-23 21:32 | Juha Manninen | Status | new => assigned |
2020-09-23 21:35 | Juha Manninen | Note Added: 0125790 | |
2020-09-23 21:37 | Anton Kavalenka | Note Added: 0125791 | |
2020-09-23 21:40 | Anton Kavalenka | Note Added: 0125793 | |
2020-09-23 21:40 | Anton Kavalenka | File Added: Здымак экрана, 2020-09-23 22-40-23.png | |
2020-09-24 11:33 | Juha Manninen | Relationship added | related to 0037802 |
2020-09-24 11:34 | Juha Manninen | Status | assigned => feedback |
2020-09-24 11:34 | Juha Manninen | LazTarget | => - |
2020-09-24 11:34 | Juha Manninen | Note Added: 0125812 | |
2020-09-24 11:56 | Anton Kavalenka | Note Added: 0125813 | |
2020-09-24 17:11 | Juha Manninen | Status | feedback => resolved |
2020-09-24 17:11 | Juha Manninen | Resolution | open => fixed |
2020-09-24 17:11 | Juha Manninen | Fixed in Revision | => 63911 |
2020-09-24 17:11 | Juha Manninen | Widgetset | GTK 3 => GTK 3 |
2020-09-24 17:11 | Juha Manninen | Note Added: 0125823 | |
2020-09-25 22:21 | Chris Rorden | Status | resolved => closed |