summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Laurence Emerson <dle3ab@angelbase.com>2013-05-28 20:50:51 -0700
committerDavid Laurence Emerson <dle3ab@angelbase.com>2013-05-28 20:50:51 -0700
commit451114d2008f0b3750bc9840099287b87cff247c (patch)
treed90151da41959a52d088a11b24e2c3278ac23611
parent8d5cbfcff09528a7038e78f672de862dadd5fd34 (diff)
downloadfpGUI-451114d2008f0b3750bc9840099287b87cff247c.tar.xz
Scroll-frame: fixed a couple bugs with RecalcFrameSize
-rw-r--r--examples/gui/scrollframe/frame_test.lpr4
-rw-r--r--src/gui/fpg_scrollframe.pas15
2 files changed, 12 insertions, 7 deletions
diff --git a/examples/gui/scrollframe/frame_test.lpr b/examples/gui/scrollframe/frame_test.lpr
index 596664e6..252f8a07 100644
--- a/examples/gui/scrollframe/frame_test.lpr
+++ b/examples/gui/scrollframe/frame_test.lpr
@@ -89,7 +89,6 @@ begin
'Click to embed another Scroll-Frame here', @click_embed_button);
OnPaint:=@paint_my_stuff;
create_buttons(self);
- RecalcFrameSize;
end;
@@ -100,10 +99,9 @@ var
begin
fpgApplication.Initialize;
form := TfpgForm.Create(nil);
- form.SetPosition(0,0,480,260);
+ form.SetPosition(0,0,380,360);
outer_frame := TfpgScrollFrame.Create(form, t_sample_frame);
outer_frame.Align:=alClient;
- outer_frame.ContentFrame.RecalcFrameSize;
try
form.Show;
fpgApplication.Run;
diff --git a/src/gui/fpg_scrollframe.pas b/src/gui/fpg_scrollframe.pas
index 8e5bc769..fd467c46 100644
--- a/src/gui/fpg_scrollframe.pas
+++ b/src/gui/fpg_scrollframe.pas
@@ -39,6 +39,7 @@ type
FMarginBR : integer;
procedure SetMarginBR (AValue: integer);
public
+ procedure AfterConstruction; override;
procedure AdjustDimsFor (w : TfpgWidget; updatewp: boolean = true);
procedure AdjustDimsWithout (w : TfpgWidget);
procedure RecalcFrameSize;
@@ -107,6 +108,12 @@ begin
RecalcFrameSize;
end;
+procedure TfpgAutoSizingFrame.AfterConstruction;
+begin
+ inherited AfterConstruction;
+ RecalcFrameSize;
+end;
+
procedure TfpgAutoSizingFrame.AdjustDimsFor (w: TfpgWidget; updatewp: boolean = true);
var
new_w, new_h: integer;
@@ -429,11 +436,11 @@ begin
inherited Create(AOwner);
FVisibleArea := TfpgEmbeddingFrame.Create(self);
- FVisibleArea.SetPosition(0, 0, 1, 1);
+ FVisibleArea.HandleMove(0, 0);
FVisibleArea.ParentScrollFrame := self;
FContentFrame := TfpgAutoSizingFrame.Create(FVisibleArea);
- FContentFrame.SetPosition(0, 0, 1, 1);
+ FContentFrame.HandleMove(0, 0);
FContentFrame.ParentScrollFrame := self;
end;
@@ -442,11 +449,11 @@ begin
inherited Create(AOwner);
FVisibleArea := TfpgEmbeddingFrame.Create(self);
- FVisibleArea.SetPosition(0, 0, 1, 1);
+ FVisibleArea.HandleMove(0, 0);
FVisibleArea.ParentScrollFrame := self;
FContentFrame := ContentFrameType.Create(FVisibleArea);
- FContentFrame.SetPosition(0, 0, 1, 1);
+ FContentFrame.HandleMove(0, 0);
FContentFrame.ParentScrollFrame := self;
end;