[fpc-pascal] resize windows in fpGui
graemeg at opensoft.homeip.net
Tue Jun 30 22:17:57 CEST 2009
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
Name := 'Button1';
SetPosition(504, 420, 80, 24);
Anchors := [anRight,anBottom];
Text := 'Button';
FontDesc := '#Label1';
Hint := '';
ImageName := '';
TabOrder := 15;
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.
- Graeme -
fpGUI - a cross-platform Free Pascal GUI toolkit
More information about the fpc-pascal