[Lazarus] OI Checkboxes

Sandro Cumerlato sandro.cumerlato at gmail.com
Wed Nov 19 19:11:12 CET 2014


>
> For me the alignment looked ok there and also on Windows, although on
> Windows the LCL theme service draws too small boxes.
> The alignment must be calculated dynamically. Theme service already
> returns the size, the location can be derived from it.
> Maybe someone creates a patch, I have other things to do in near future.
>

Please review attached patch (commented-out code seems not needed).

Alignment is better on Windows now: checkboxes are vertically aligned now,
only text left position is different.

Sandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141119/9695f684/attachment-0003.html>
-------------- next part --------------
Index: components/ideintf/objectinspector.pp
===================================================================
--- components/ideintf/objectinspector.pp	(revisione 46889)
+++ components/ideintf/objectinspector.pp	(copia locale)
@@ -2622,21 +2622,18 @@
     if FCurrentEdit<>nil then
     begin
       // resize the edit component
-      Dec(EditCompRect.Left);
-      Dec(EditCompRect.Top);
-      Inc(EditCompRect.Bottom);
+      if (FCurrentEdit is TEdit) or (FCurrentEdit is TComboBox) then
+      begin
+        Dec(EditCompRect.Left);
+        Dec(EditCompRect.Top);
+        Inc(EditCompRect.Bottom);
+      end;
       //debugln('TOICustomPropertyGrid.AlignEditComponents A ',dbgsName(FCurrentEdit),' ',dbgs(EditCompRect));
       if not CompareTopLeft(FCurrentEdit.BoundsRect,EditCompRect) then
       begin
-        if FCurrentEdit is TCheckBox then
-        begin
-          FCurrentEdit.Top := EditCompRect.Top;
-          FCurrentEdit.Left := EditCompRect.Left;
-        end
-        else
-          FCurrentEdit.BoundsRect:=EditCompRect;
-        if FCurrentEdit is TComboBox then
-          TComboBox(FCurrentEdit).ItemHeight:=EditCompRect.Bottom-EditCompRect.Top-6;
+        FCurrentEdit.BoundsRect:=EditCompRect;
+//        if FCurrentEdit is TComboBox then
+//          TComboBox(FCurrentEdit).ItemHeight:=EditCompRect.Bottom-EditCompRect.Top-6;
         FCurrentEdit.Invalidate;
       end;
     end;
@@ -2690,7 +2687,7 @@
   else
   begin
     inc(NameIconRect.Right, 2 + Ord(ShowGutter));
-    inc(NameTextRect.Left,  3 + Ord(ShowGutter));
+    inc(NameTextRect.Left, 3 + Ord(ShowGutter));
   end;
 
   DrawState:=[];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: checkbox4.png
Type: image/png
Size: 3381 bytes
Desc: not available
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20141119/9695f684/attachment-0003.png>


More information about the Lazarus mailing list