Re: [Lazarus] GTK2 GroupBox auto size
On Monday, July 7, 2014, zeljko wrote: > > hm... > APPLICATION ERROR #400 > > Database connection failed. Error received from database was #1040: Too > many connections. ... etc > I happened to have 2 machines open when I got this error. It failed with Windows + FireFox. It worked well with Linux + QupZilla browser. Now I tested again and it works with all systems. How can OS or browser make a difference for the server's DB connections. I don't know. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On 07/07/2014 01:37 PM, Michael Van Canneyt wrote: On Mon, 7 Jul 2014, zeljko wrote: On 07/07/2014 01:14 PM, Henry Vermaak wrote: On Sun, Jul 06, 2014 at 01:40:53PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 01:03:19PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: I applied the patch from Henry. I hope we get LCL-Win fixed, too. Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with MeasureText and some more magic to take the borders into account. I've uploaded a patch to the bug report. The hard coded numbers don't feel very good, but I haven't found a better way of doing it. The other GetPreferredSize implementations in the file also seem to do that. Since I can't reach the bug tracker, I'll attach the Qt patch here so Zeljan can have a look. Seem that bugtracker is down. Should be back up. hm... APPLICATION ERROR #400 Database connection failed. Error received from database was #1040: Too many connections. ... etc z. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Mon, 7 Jul 2014, zeljko wrote: On 07/07/2014 01:37 PM, Michael Van Canneyt wrote: On Mon, 7 Jul 2014, zeljko wrote: On 07/07/2014 01:14 PM, Henry Vermaak wrote: On Sun, Jul 06, 2014 at 01:40:53PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 01:03:19PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: I applied the patch from Henry. I hope we get LCL-Win fixed, too. Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with MeasureText and some more magic to take the borders into account. I've uploaded a patch to the bug report. The hard coded numbers don't feel very good, but I haven't found a better way of doing it. The other GetPreferredSize implementations in the file also seem to do that. Since I can't reach the bug tracker, I'll attach the Qt patch here so Zeljan can have a look. Seem that bugtracker is down. Should be back up. hm... APPLICATION ERROR #400 Database connection failed. Error received from database was #1040: Too many connections. ... etc I increased the number of allowed connections. Hopefully that will be enough. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Mon, 7 Jul 2014, zeljko wrote: On 07/07/2014 01:14 PM, Henry Vermaak wrote: On Sun, Jul 06, 2014 at 01:40:53PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 01:03:19PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: I applied the patch from Henry. I hope we get LCL-Win fixed, too. Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with MeasureText and some more magic to take the borders into account. I've uploaded a patch to the bug report. The hard coded numbers don't feel very good, but I haven't found a better way of doing it. The other GetPreferredSize implementations in the file also seem to do that. Since I can't reach the bug tracker, I'll attach the Qt patch here so Zeljan can have a look. Seem that bugtracker is down. Should be back up. Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On 07/07/2014 01:14 PM, Henry Vermaak wrote: On Sun, Jul 06, 2014 at 01:40:53PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 01:03:19PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: I applied the patch from Henry. I hope we get LCL-Win fixed, too. Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with MeasureText and some more magic to take the borders into account. I've uploaded a patch to the bug report. The hard coded numbers don't feel very good, but I haven't found a better way of doing it. The other GetPreferredSize implementations in the file also seem to do that. Since I can't reach the bug tracker, I'll attach the Qt patch here so Zeljan can have a look. Seem that bugtracker is down. zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On 07/07/2014 01:14 PM, Henry Vermaak wrote: On Sun, Jul 06, 2014 at 01:40:53PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 01:03:19PM +0100, Henry Vermaak wrote: On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: I applied the patch from Henry. I hope we get LCL-Win fixed, too. Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with MeasureText and some more magic to take the borders into account. I've uploaded a patch to the bug report. The hard coded numbers don't feel very good, but I haven't found a better way of doing it. The other GetPreferredSize implementations in the file also seem to do that. Since I can't reach the bug tracker, I'll attach the Qt patch here so Zeljan can have a look. Looks good. I'll upload this patch to the issue. zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Sun, Jul 06, 2014 at 01:40:53PM +0100, Henry Vermaak wrote: > On Sat, Jul 05, 2014 at 01:03:19PM +0100, Henry Vermaak wrote: > > On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: > > > I applied the patch from Henry. I hope we get LCL-Win fixed, too. > > > > Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with > > MeasureText and some more magic to take the borders into account. > > I've uploaded a patch to the bug report. The hard coded numbers don't > feel very good, but I haven't found a better way of doing it. The other > GetPreferredSize implementations in the file also seem to do that. Since I can't reach the bug tracker, I'll attach the Qt patch here so Zeljan can have a look. Henry Index: lcl/interfaces/qt/qtwidgets.pas === --- lcl/interfaces/qt/qtwidgets.pas (revision 45807) +++ lcl/interfaces/qt/qtwidgets.pas (working copy) @@ -7730,7 +7730,7 @@ ASize: TSize; begin QWidget_getContentsMargins(Widget,@L, @T, @R, @B); - QWidget_sizeHint(Widget, @ASize); + QGroupBox_minimumSizeHint(QGroupBoxH(Widget), @ASize); PreferredWidth := ASize.cx + L + R; PreferredHeight := ASize.cy + B + T; {$IFDEF VerboseQtResize} Index: lcl/interfaces/qt/qtwsstdctrls.pp === --- lcl/interfaces/qt/qtwsstdctrls.pp (revision 45807) +++ lcl/interfaces/qt/qtwsstdctrls.pp (working copy) @@ -55,6 +55,8 @@ class function GetDefaultClientRect(const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect ): boolean; override; +class procedure GetPreferredSize(const AWinControl: TWinControl; + var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); override; end; { TQtWSGroupBox } @@ -1317,6 +1319,15 @@ end; end; +class procedure TQtWSCustomGroupBox.GetPreferredSize( + const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; + WithThemeSpace: Boolean); +begin + if AWinControl.HandleAllocated then +TQtGroupBox(AWinControl.Handle).PreferredSize(PreferredWidth, + PreferredHeight, WithThemeSpace); +end; + { TQtWSCustomComboBox } {-- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Sat, Jul 05, 2014 at 01:03:19PM +0100, Henry Vermaak wrote: > On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: > > I applied the patch from Henry. I hope we get LCL-Win fixed, too. > > Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with > MeasureText and some more magic to take the borders into account. I've uploaded a patch to the bug report. The hard coded numbers don't feel very good, but I haven't found a better way of doing it. The other GetPreferredSize implementations in the file also seem to do that. Henry -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Sat, Jul 05, 2014 at 02:05:10PM +0300, Juha Manninen wrote: > I applied the patch from Henry. I hope we get LCL-Win fixed, too. Thanks. I'll look into lcl-win, it'll need a GetPreferredSize with MeasureText and some more magic to take the borders into account. Henry -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On 07/05/2014 01:05 PM, Juha Manninen wrote: I applied the patch from Henry. I hope we get LCL-Win fixed, too. Zeljan, is it ok if LCL-QT gets the same change at some point? And yes, Panels and Forms should logically behave the same way but they are not urgent. Don't know how it will behave. You should try to change it and see if it works. Especially grupboxes used by IDE. z. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
I applied the patch from Henry. I hope we get LCL-Win fixed, too. Zeljan, is it ok if LCL-QT gets the same change at some point? And yes, Panels and Forms should logically behave the same way but they are not urgent. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Friday, July 4, 2014, Vojtěch Čihák wrote: > And what about autosized forms? I mean: why it does NOT matter with Panels > and Forms but it (exclusively) matters with GroupBox. > Good question. I think it should matter with forms, too. OTOH, forms are typically bigger and this issue does not come up so often. With panels it is irrelevant because the caption there is not useful. At least I always make it empty and use other controls (Label) for texts. They can be anchored etc. With GroupBox this really matters. I have pumped into this problem many times and I believe Lazarus IDE dialogs have captions cut for this same reason. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
@ I want to see it fixed! Gtk2 and Windows were mentioned. What about other widgetsets, how do they behave? Qt has this issue too (i.e. GroupBox is autosized around children, long caption is not fuly visible). @ My logic also says that if the user has set a caption and defined a control to be autosized, the text should be visible. In what situation would it be useful to cut it automatically? And what about autosized forms? I mean: why it does NOT matter with Panels and Forms but it (exclusively) matters with GroupBox. Although, I am more-less neutral in this case, if it will be patched or not. Vojtěch __ Od: Juha Manninen Komu: Lazarus mailing list Datum: 04.07.2014 17:16 Předmět: Re: [Lazarus] GTK2 GroupBox auto size On Friday, July 4, 2014, Vojtěch Čihák > wrote: So it seems more a feature than a bug to me. To me it seems like yet another bug in Delphi.When talking about GroupBox it is actually a missing feature in Delphi.My logic also says that if the user has set a caption and defined a control to be autosized, the text should be visible. In what situation would it be useful to cut it automatically?And yes, automatic layout + anchors in LCL are already more advanced than the Delphi equivalent. Delphi compatibility is a lame excuse for such bugs.I want to see it fixed! Gtk2 and Windows were mentioned. What about other widgetsets, how do they behave?There are more bug reports for the same thing. I will find them ...Juha -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus> -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Friday, July 4, 2014, Vojtěch Čihák wrote: > > So it seems more a feature than a bug to me. > To me it seems like yet another bug in Delphi. When talking about GroupBox it is actually a missing feature in Delphi. My logic also says that if the user has set a caption and defined a control to be autosized, the text should be visible. In what situation would it be useful to cut it automatically? And yes, automatic layout + anchors in LCL are already more advanced than the Delphi equivalent. Delphi compatibility is a lame excuse for such bugs. I want to see it fixed! Gtk2 and Windows were mentioned. What about other widgetsets, how do they behave? There are more bug reports for the same thing. I will find them ... Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Fri, Jul 04, 2014 at 03:19:33PM +0200, zeljko wrote: > On 07/04/2014 03:13 PM, Vojtěch Čihák wrote: > >Hi, > > > >Delphi has no TGroupBox.Autosize but it has TPanel.AutoSize. > > > >When I put children on Panel, set very long Panel.Caption and > >Panel.AutoSize:=True then panel shrinks to the smallest possible size > >(around children) ignoring its own Caption. > > > >So it seems more a feature than a bug to me. > > +1 See my reply to Vojtěch. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Fri, Jul 04, 2014 at 03:13:19PM +0200, Vojtěch Čihák wrote: > Hi, > > Delphi has no TGroupBox.Autosize but it has TPanel.AutoSize. I really don't care about Delphi. If I did I would be using it. > When I put children on Panel, set very long Panel.Caption and > Panel.AutoSize:=True then panel shrinks to the smallest possible size > (around children) ignoring its own Caption. I haven't seen anyone use a Panel with a caption and children. The caption is useless for exactly the reason you point out. You can at least get around it by putting a label inside the panel. > So it seems more a feature than a bug to me. I have software that's translatable, I've set my TRadioGroup size manually (because AutoSize doesn't work) to accommodate the English translation. Now I change the translation to another language, but the caption is now longer, so it gets clipped. You call this a feature? My users don't agree with you. Now I need to manually calculate the minimum size of the control based on the length of the text in the current translation. I also need to factor in borders, themes, etc. That's exactly the type of problem that AutoSize sets out to solve, since all this information is already in the widget set. The same happens if the theme changes and the font size gets increased. Delphi has this massive design flaw because it's based on absolute positions and dimensions. Lazarus goes a long way to fix this by the AutoSize and anchoring mechanisms. Henry -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On 07/04/2014 03:13 PM, Vojtěch Čihák wrote: Hi, Delphi has no TGroupBox.Autosize but it has TPanel.AutoSize. When I put children on Panel, set very long Panel.Caption and Panel.AutoSize:=True then panel shrinks to the smallest possible size (around children) ignoring its own Caption. So it seems more a feature than a bug to me. +1 zeljko -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
Hi, Delphi has no TGroupBox.Autosize but it has TPanel.AutoSize. When I put children on Panel, set very long Panel.Caption and Panel.AutoSize:=True then panel shrinks to the smallest possible size (around children) ignoring its own Caption. So it seems more a feature than a bug to me. Vojtěch __ Od: Henry Vermaak Komu: Lazarus mailing list Datum: 04.07.2014 13:40 Předmět: [Lazarus] GTK2 GroupBox auto size Hi The GroupBox auto size doesn't work very well, because it doesn't take the label width into account. If the label is wider than all of the children, it will get clipped. Any reason why GetGTKDefaultWidgetSize wasn't used, like virtually everywhere else in gtk2wsstdctrls.pp? I attach a patch that uses GetGTKDefaultWidgetSize. Henry -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus <http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus> -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Fri, Jul 04, 2014 at 01:03:56PM +0100, Henry Vermaak wrote: > On Fri, Jul 04, 2014 at 12:39:12PM +0100, Henry Vermaak wrote: > > Hi > > > > The GroupBox auto size doesn't work very well, because it doesn't take > > the label width into account. If the label is wider than all of the > > children, it will get clipped. Any reason why GetGTKDefaultWidgetSize > > wasn't used, like virtually everywhere else in gtk2wsstdctrls.pp? > > > > I attach a patch that uses GetGTKDefaultWidgetSize. > > http://bugs.freepascal.org/view.php?id=20447 Same happens on Windows. There isn't even a GetPreferredSize() member, so that probably needs to be added containing MeasureText() and some code to calculate border widths. I don't really know how the win32 widgetset works, though. Henry -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] GTK2 GroupBox auto size
On Fri, Jul 04, 2014 at 12:39:12PM +0100, Henry Vermaak wrote: > Hi > > The GroupBox auto size doesn't work very well, because it doesn't take > the label width into account. If the label is wider than all of the > children, it will get clipped. Any reason why GetGTKDefaultWidgetSize > wasn't used, like virtually everywhere else in gtk2wsstdctrls.pp? > > I attach a patch that uses GetGTKDefaultWidgetSize. http://bugs.freepascal.org/view.php?id=20447 Henry -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] GTK2 GroupBox auto size
Hi The GroupBox auto size doesn't work very well, because it doesn't take the label width into account. If the label is wider than all of the children, it will get clipped. Any reason why GetGTKDefaultWidgetSize wasn't used, like virtually everywhere else in gtk2wsstdctrls.pp? I attach a patch that uses GetGTKDefaultWidgetSize. Henry Index: lcl/interfaces/gtk2/gtk2wsstdctrls.pp === --- lcl/interfaces/gtk2/gtk2wsstdctrls.pp (revision 45769) +++ lcl/interfaces/gtk2/gtk2wsstdctrls.pp (working copy) @@ -2365,32 +2365,9 @@ class procedure TGtk2WSCustomGroupBox.GetPreferredSize( const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer; WithThemeSpace: Boolean); -var - Widget: PGtkWidget; - border_width: Integer; begin - Widget := PGtkWidget(GetFrameWidget({%H-}PGTKEventBox(AWinControl.Handle))); - - if Assigned(PGtkFrame(Widget)^.label_widget) then - begin -PreferredWidth := gtk_widget_get_xthickness(Widget) * 2 + -gtk_widget_get_xthickness(PGtkFrame(Widget)^.label_widget); -PreferredHeight := Max(gtk_widget_get_ythickness(Widget), - gtk_widget_get_ythickness(PGtkFrame(Widget)^.label_widget)) + - gtk_widget_get_ythickness(Widget); - end else - begin -PreferredWidth := gtk_widget_get_xthickness(Widget) * 2; -PreferredHeight := gtk_widget_get_ythickness(Widget) * 2; - end; - - if WithThemeSpace then - begin -border_width := (PGtkContainer(Widget)^.flag0 and bm_TGtkContainer_border_width) shr -bp_TGtkContainer_border_width; -inc(PreferredWidth, border_width); -inc(PreferredHeight, 2 * border_width); - end; + GetGTKDefaultWidgetSize(AWinControl, PreferredWidth, PreferredHeight, + WithThemeSpace); end; class procedure TGtk2WSCustomGroupBox.SetFont(const AWinControl: TWinControl; -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus