summaryrefslogtreecommitdiff
path: root/src/gui/fpg_radiobutton.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2009-06-23 13:10:09 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2009-06-23 13:10:09 +0200
commitace5a931cb58672e7805813276cb97caeacf7c93 (patch)
tree3751a90c67c7092f34f055a06ac9bf334dfb5644 /src/gui/fpg_radiobutton.pas
parenta50cd6cb09146a43b3efb639399e2a9543e074c8 (diff)
downloadfpGUI-ace5a931cb58672e7805813276cb97caeacf7c93.tar.xz
Fix overlapping text in RadioButton and CheckBox
* If BoxLayout = right, then the text caption could paint over the radio or check images. This is now fixed.
Diffstat (limited to 'src/gui/fpg_radiobutton.pas')
-rw-r--r--src/gui/fpg_radiobutton.pas11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gui/fpg_radiobutton.pas b/src/gui/fpg_radiobutton.pas
index c0bb20da..97303bb5 100644
--- a/src/gui/fpg_radiobutton.pas
+++ b/src/gui/fpg_radiobutton.pas
@@ -184,19 +184,23 @@ var
tx: integer;
img: TfpgImage;
ix: integer;
+ cliprect: TfpgRect;
begin
inherited HandlePaint;
Canvas.SetColor(FBackgroundColor);
Canvas.FillRectangle(0, 0, Width, Height);
Canvas.SetFont(Font);
+ cliprect.SetRect(1, 1, Width-2, Height-2);
if FFocused then
begin
Canvas.SetColor(clText1);
Canvas.SetLineStyle(1, lsDot);
- Canvas.DrawRectangle(1, 1, Width-2, Height-2);
+ Canvas.DrawRectangle(cliprect);
+ InflateRect(cliprect, 1, 1);
end;
+ Canvas.SetClipRect(cliprect);
Canvas.SetLineStyle(1, lsSolid);
if FBoxLayout = tbLeftBox then
@@ -223,7 +227,7 @@ begin
inc(r.left, 2);
end
else
- tx := 0;
+ tx := 3; // leave space for focus rectangle
inc(r.top, 1);
// paint the radio button
img := fpgImages.GetImage('sys.radiobuttons'); // Do NOT localize
@@ -233,6 +237,9 @@ begin
if ty < 0 then
ty := 0;
Canvas.SetTextColor(FTextColor);
+ Canvas.ClearClipRect;
+ cliprect.SetRect(tx, ty, Width-FBoxSize-8, cliprect.Height);
+ Canvas.SetClipRect(cliprect);
fpgStyle.DrawString(Canvas, tx, ty, FText, Enabled);
end;