Hi,
I recently created report http://bugs.freepascal.org/view.php?id=19658
This was about panels that behave a little differently to panels in Lazarus Windows and Delphi. There were no comments or feedback request there so I decided to take a look
After some investigation it appeared that the problem was because GtkFrame was used. The problem with this widget is that one can't control the postion and painting in a small area two pixels around it. So every nested TPanel in GTK2 Lazarus smaller by 4 pixels that the parent no matter what (the consequences can be seen in the screenshots from Panel.zip). Looking at the code I also noticed that no special features of GtkFrame were used, all panel drawings take place inside paltform-independent part of LCL.
Trying to solve the problem, I ended up with the following replacement in the TGtk2WSCustomPanel.CreateHandle
{ -------- Before }
Frame := gtk_frame_new(nil);
gtk_frame_set_shadow_type(PGtkFrame(Frame),
BorderStyleShadowMap[TCustomControl(AWinControl).BorderStyle]);{ -------- After }
Frame:=gtk_scrolled_window_new(nil, nil);
gtk_scrolled_window_set_shadow_type(PGtkScrolledWindow(Frame),
BorderStyleShadowMap[TCustomControl(AWinControl).BorderStyle]);
gtk_scrolled_window_set_policy(PGtkScrolledWindow(Frame),
GTK_POLICY_NEVER, GTK_POLICY_NEVER);After this change the problem project that looked identically (good) in Delphi and Win32 Lazarus and differently in GTK2 Lazarus (labels and panels at wrong positions) began to look consistent in linux.
So there are questions:
- Can this patch be applied? Apart from obvious testing and checking, there is also a compatibility problem. After this change, the forms people designed in linux can start to look a little different (or even greatly if the nesting level of panels is deep). But as I noted in the report, without this change it's difficult to synchronize forms "visually".
- Does using GtkFrame in LCL make sense at all? I did not look deeper, but at least quick search showed it was used several times.
Thanks,
Max Vlasov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110701/c5f42081/attachment.html>
