[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Maximizing a form.

Posted on 2007-03-22
13
Medium Priority
?
408 Views
Last Modified: 2010-04-05
Hi Experts,
I have a form that contains a lot of components. Some of these components contain other components.(for example a pagecontrol which contains tabsheets which contains labels containing other labels). When I maximize this form at runtime, all the components stay in one corner. How do I get the components to spread out and fill the form when it is maximized. When searching through the answers database, it said to set the align property to 'alclient'. Did it mean the form itself or of each component?
0
Comment
Question by:QurbanDurrani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
13 Comments
 
LVL 6

Accepted Solution

by:
Hardi earned 1600 total points
ID: 18776279
You can set the anchors of components.
Align to alClient will maximise the control, so that it's size is the same as its parent
You may also want to put some controls in a panel, and set the panel's Align property. Eg. set one of them to alLeft, the other to alClient, so when resized, only the one with alClient gets larger (in Width).
You may also want to drop Splitter between those panels so they can be resized manually.
0
 
LVL 5

Expert Comment

by:kosturdur
ID: 18776286
-if you want your form run in maximized changed form.windowstate = wsmaximized
-if you want your pagecontrol maximized when the form maximized form change pageconrol.align=alclient
kosturdur
0
 
LVL 6

Expert Comment

by:Hardi
ID: 18776304
I should correct
"Align to alClient will maximise the control, so that it's size is the same as its parent"
to
Align to alClient will maximise the control to fill as much space as possible, so that it's size could be as large as its parent (but no more)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Hardi
ID: 18777187
You can play around with this. Try resizing the form and try the spliiter. Pay attention to each component's Align and Anchors

Unit1.dfm
========
object Form1: TForm1
  Left = 192
  Top = 114
  Width = 559
  Height = 349
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Splitter1: TSplitter
    Left = 185
    Top = 0
    Height = 315
  end
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 185
    Height = 315
    Align = alLeft
    Caption = 'Panel1'
    TabOrder = 0
    DesignSize = (
      185
      315)
    object Label1: TLabel
      Left = 120
      Top = 269
      Width = 32
      Height = 13
      Anchors = [akRight, akBottom]
      Caption = 'Label1'
    end
  end
  object Panel2: TPanel
    Left = 188
    Top = 0
    Width = 363
    Height = 315
    Align = alClient
    Caption = 'Panel2'
    TabOrder = 1
    DesignSize = (
      363
      315)
    object Button1: TButton
      Left = 24
      Top = 24
      Width = 309
      Height = 49
      Anchors = [akLeft, akTop, akRight, akBottom]
      Caption = 'Button1'
      TabOrder = 0
    end
  end
end

========
Unit1.pas
========
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Splitter1: TSplitter;
    Panel2: TPanel;
    Button1: TButton;
    Label1: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

end.
0
 
LVL 6

Assisted Solution

by:saravananvg
saravananvg earned 400 total points
ID: 18777482
Hello Sir
 You could use either anchor property for each component or a vcl called GTSizer which will automatically change the size of the controls based upon the change in the size of the form or the resolution. But the best way is to use the anchor property for each component.

with regards,
padmaja.
0
 

Author Comment

by:QurbanDurrani
ID: 18781999
Thanks to all.
Saravananvq, Why do you say it is better to use anchor property  for each component rather than GTSizer?
0
 
LVL 6

Expert Comment

by:Hardi
ID: 18783037
You can easily do it using anchors and align, and OnResize if you need to (eg. to keep a component in the centre). Why would you download another component.
Well that's just my opinion =P
0
 

Author Comment

by:QurbanDurrani
ID: 18789288
Sure, but for an application that already exists, I would have to do this for very component on every form.
0
 
LVL 6

Expert Comment

by:Hardi
ID: 18789746
I see.
I think GTSizer can do the all resize automatically, as well as the fonts depending on user's screen resolution. It must be a handy component.
Why dont you give the trial version a try
http://www.genotechs.com/downloads.html
You can compare how much easier and better it is than setting anchors manually, and decide whether to buy it or not :-)
0
 

Author Comment

by:QurbanDurrani
ID: 18789777
Thanks hardi for such a prompt comment on a sunday. I have been playing around with the trial version of GTSizer and it seems to work ok for the most part. A friend of mine suggested a 'TFormSize' component from 'tmssoftware.com' which is lot cheeper but does not have a trial version available to play around with. Do you know about the capabilities of this component?
0
 
LVL 6

Expert Comment

by:Hardi
ID: 18789856
I don't know about TFormSize, but I found it here
http://www.tmssoftware.com/formsize.htm
but it doesn't mention auto-resizing components, and you can download it for free.
May be it's not the component you're looking for? =P
Btw it's monday morning here in Australia :-D
0
 

Author Comment

by:QurbanDurrani
ID: 18789881
Thanks to everyone for your help.
Hardi, So you are in Australia, I am in Canada. You know I have been working in the technical field for some time now, but it's impect on the humanity still amazes me sometimes. Just look at us, Someone in Australia helping someone in Canada pretty much realtime. Thanks again.
0
 
LVL 6

Expert Comment

by:Hardi
ID: 18789903
Glad to help :-)
Yea... unbelievable isn't it... this world is getting smaller with technologies ^^
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question