Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-06

resize windows in fpGui

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

kota kota

How can i make a window to shrink instead of losing its elements(buttons, labels) when it is being re-sized ?
(with losing i mean that a button which is placed at the Right-down- corner of a window will be invisible is the user shrinks the window from the Right-down- corner)

Thank you

Reply by email

Graeme Geldenhuys
to kota kota
kota kota wrote
How can i make a window to shrink instead of losing its elements(buttons, labels) when it is being re-sized ?

Use the Anchor property. By default the anTop and anLeft anchors are set on all components. If you used the UI Designer to visually design your form, then select the component (for example a Button), then in the Object Inspector windows click the Right and Botton anchor buttons and deselect (click them to toggle them) default Top and Left anchors.

The UI Designer writes the gui design into a method called AfterCreate() and it will look something like show below.

========================
  Button1 := TfpgButton.Create(self);
  with Button1 do
  begin
    Name := 'Button1';
    SetPosition(504, 420, 80, 24);
    Anchors := [anRight,anBottom];
    Text := 'Button';
    FontDesc := '#Label1';
    Hint := '';
    ImageName := '';
    TabOrder := 15;
  end;
========================

You can set the Anchors at design time and resize the design form to see what happens. For example, setting all four anchors, the component will grow and shrink as the form is resized.

Regards,
- Graeme -

________________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

kota kota
to Graeme Geldenhuys

Thank you very much.

2009/6/30 Graeme Geldenhuys

Show quoted text 46 lines
kota kota wrote: > How can i make a window to shrink instead of losing its elements(buttons, > labels) when it is being re-sized ? > Use the Anchor property. By default the anTop and anLeft anchors are set on all components. If you used the UI Designer to visually design your form, then select the component (for example a Button), then in the Object Inspector windows click the Right and Botton anchor buttons and deselect (click them to toggle them) default Top and Left anchors. The UI Designer writes the gui design into a method called AfterCreate() and it will look something like show below. ======================== Button1 := TfpgButton.Create(self); with Button1 do begin Name := 'Button1'; SetPosition(504, 420, 80, 24); Anchors := [anRight,anBottom]; Text := 'Button'; FontDesc := '#Label1'; Hint := ''; ImageName := ''; TabOrder := 15; end; ======================== You can set the Anchors at design time and resize the design form to see what happens. For example, setting all four anchors, the component will grow and shrink as the form is resized. Regards, - Graeme - ________________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email