summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-20 12:06:24 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-20 12:06:24 +0000
commit0e49b0dfcd4143988b7c5cd6094f821b709e36bd (patch)
tree2a3874116cdaf2f539d79d8c504009e3eb907d79
parent1f7bbc75ab6a277868fe9ef7594e015db6295a45 (diff)
downloadfpGUI-0e49b0dfcd4143988b7c5cd6094f821b709e36bd.tar.xz
* Finally fixed the Windows bug in the UI Designer when you move components quickly in the design form. * Undone some changes I accidentily checked in in revision 634 regarding the newformdesigner.pas unit.
-rw-r--r--examples/apps/uidesigner/newformdesigner.pas43
-rw-r--r--src/corelib/gdi/gfx_gdi.pas20
2 files changed, 18 insertions, 45 deletions
diff --git a/examples/apps/uidesigner/newformdesigner.pas b/examples/apps/uidesigner/newformdesigner.pas
index f9a111e8..429556fc 100644
--- a/examples/apps/uidesigner/newformdesigner.pas
+++ b/examples/apps/uidesigner/newformdesigner.pas
@@ -145,8 +145,6 @@ type
TfrmAbout = class(TfpgForm)
- private
- procedure ApplyScreenRatio;
public
{@VFD_HEAD_BEGIN: frmAbout}
lblName1: TfpgLabel;
@@ -183,37 +181,7 @@ uses
{@VFD_NEWFORM_IMPL}
-procedure TfrmAbout.ApplyScreenRatio;
-var
- i: integer;
- wg: TfpgWidget;
- ratio: double;
-begin
-// writeln('dpi = ', fpgApplication.Screen_dpi);
- // Form was designed at 96 dpi.
- ratio := 96 / fpgApplication.Screen_dpi;
- for i := 0 to ComponentCount-1 do
- begin
- if Components[i] is TfpgWidget then
- begin
- wg := TfpgWidget(Components[i]);
- wg.Top := round(wg.Top * ratio);
- wg.Left := round(wg.Left * ratio);
- wg.Width := round(wg.Width * ratio);
- wg.Height := round(wg.Height * ratio);
- end;
- end;
-end;
-
procedure TfrmAbout.AfterCreate;
- function FontRatio(ASize: integer): string;
- begin
- Result := Format('%d', [round(ASize*((96/fpgApplication.Screen_dpi)-0.1))]);
- if StrToInt(Result) <= 6 then // sanity check
- Result := '8';
- writeln('Old:', ASize, ' New:', Result);
- end;
-
begin
{@VFD_BODY_BEGIN: frmAbout}
Name := 'frmAbout';
@@ -228,8 +196,7 @@ begin
Name := 'lblName1';
SetPosition(12, 16, 255, 31);
Text := 'fpGUI UI Designer';
- FontDesc := 'Arial-' + FontRatio(20);
- backgroundcolor := clGreen;
+ FontDesc := 'Arial-20';
end;
lblVersion := TfpgLabel.Create(self);
@@ -259,7 +226,7 @@ begin
Name := 'lblName3';
SetPosition(12, 100, 241, 14);
Text := 'Written by Graeme Geldenhuys';
- FontDesc := 'Arial-' + FontRatio(9);
+ FontDesc := 'Arial-9';
end;
lblName4 := TfpgLabel.Create(self);
@@ -268,7 +235,7 @@ begin
Name := 'lblName4';
SetPosition(12, 116, 246, 14);
Text := 'http://opensoft.homeip.net/fpgui/';
- FontDesc := 'Arial-' + FontRatio(9) + ':underline';
+ FontDesc := 'Arial-9:underline';
end;
lblCompiled := TfpgLabel.Create(self);
@@ -277,12 +244,10 @@ begin
Name := 'lblCompiled';
SetPosition(12, 132, 191, 13);
Text := 'Compiled on: %s';
- FontDesc := 'Arial-' + FontRatio(8);
+ FontDesc := 'Arial-8';
end;
{@VFD_BODY_END: frmAbout}
-
- ApplyScreenRatio;
end;
class procedure TfrmAbout.Execute;
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas
index a1358b4b..d77c27c6 100644
--- a/src/corelib/gdi/gfx_gdi.pas
+++ b/src/corelib/gdi/gfx_gdi.pas
@@ -664,9 +664,14 @@ begin
{$IFDEF DEBUG}
writeln('fpGFX/GDI:', w.ClassName + ': MouseButtonDown event');
{$ENDIF}
+ // This is temporary and we should try and move it to
+ // the UI Designer code instead.
+ if (uMsg = WM_LBUTTONDOWN) and (w is TfpgWidget) then
+ begin
+ if TfpgWidget(w).FormDesigner <> nil then
+ w.CaptureMouse;
+ end;
mcode := FPGM_MOUSEDOWN;
-// if PopupListFirst = nil then
-// SetCapture(w.WinHandle);
end;
WM_LBUTTONUP,
@@ -676,12 +681,15 @@ begin
{$IFDEF DEBUG}
writeln('fpGFX/GDI:', w.ClassName + ': MouseButtonUp event');
{$ENDIF}
+ // This is temporary and we should try and move it to
+ // the UI Designer code instead.
+ if (uMsg = WM_LBUTTONUP) and (w is TfpgWidget) then
+ begin
+ if TfpgWidget(w).FormDesigner <> nil then
+ w.ReleaseMouse;
+ end;
mcode := FPGM_MOUSEUP;
-// if PopupListFirst = nil then
-// ReleaseCapture;
end;
- //WM_LBUTTONDBLCLK:
- //mcode := FPGM_DOUBLECLICK;
else
mcode := 0;
end;