diff options
-rw-r--r-- | src/gui/fpg_button.pas | 4 | ||||
-rw-r--r-- | src/gui/fpg_editbtn.pas | 27 | ||||
-rw-r--r-- | src/gui/fpg_panel.pas | 4 |
3 files changed, 21 insertions, 14 deletions
diff --git a/src/gui/fpg_button.pas b/src/gui/fpg_button.pas index 32fb543d..9edb0463 100644 --- a/src/gui/fpg_button.pas +++ b/src/gui/fpg_button.pas @@ -293,8 +293,8 @@ begin inherited Create(AOwner); FText := 'Button'; FFont := fpgGetFont('#Label1'); - FHeight := FFont.Height + 8; - FWidth := 80; + Height := FFont.Height + 8; + Width := 80; FFocusable := True; FTextColor := Parent.TextColor; FBackgroundColor := clButtonFace; diff --git a/src/gui/fpg_editbtn.pas b/src/gui/fpg_editbtn.pas index 0cba4f18..a4d1c469 100644 --- a/src/gui/fpg_editbtn.pas +++ b/src/gui/fpg_editbtn.pas @@ -188,29 +188,35 @@ end; procedure TfpgBaseEditButton.HandleResize(AWidth, AHeight: TfpgCoord); begin inherited HandleResize(AWidth, AHeight); - if csDesigning in ComponentState then + { resizing can now occur before the component is shown, so we need extra + checks here, like are we still busy creating everything. } + if not (csLoading in ComponentState) then begin - FEdit.Visible := False; - FButton.Visible := False; - end - else - begin - FEdit.SetPosition(0, 0, AWidth - AHeight, AHeight); - FButton.SetPosition(AWidth - AHeight, 0, AHeight, AHeight); + if csDesigning in ComponentState then + begin + FEdit.Visible := False; + FButton.Visible := False; + end + else + begin + FEdit.SetPosition(0, 0, AWidth - AHeight, AHeight); + FButton.SetPosition(AWidth - AHeight, 0, AHeight, AHeight); + end; end; end; constructor TfpgBaseEditButton.Create(AOwner: TComponent); begin inherited Create(AOwner); - FWidth := 140; - FHeight := 24; + Width := 140; + Height := 24; FReadOnly := False; FEdit := TfpgEdit.Create(self); with FEdit do begin Name := 'FEdit'; + SetPosition(0, 0, self.Width - self.Height, self.Height); Text := ''; FontDesc := '#Edit1'; TabOrder := 0; @@ -220,6 +226,7 @@ begin with FButton do begin Name := 'FButton'; + SetPosition(self.Width - self.Height, 0, self.Height, self.Height); Text := ''; FontDesc := '#Label1'; ImageMargin := -1; diff --git a/src/gui/fpg_panel.pas b/src/gui/fpg_panel.pas index 66ed5778..112ca0ea 100644 --- a/src/gui/fpg_panel.pas +++ b/src/gui/fpg_panel.pas @@ -331,8 +331,8 @@ begin inherited Create(AOwner); FPanelStyle := bsRaised; FPanelBorder := bsSingle; - FWidth := 80; - FHeight := 80; + Width := 80; + Height := 80; FFocusable := True; // otherwise children can't get focus FParentBackgroundColor := False; FIsContainer := True; |