Sign in Join

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

Mailing lists / lazarus / 2010-02

qurstion in Button Alignment

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

ik

Hello,

I wish to create a component that gives 10 buttons aligning 5 buttons on each side.
The thing is, that I want to make both sides resize using anchors or something like that.
The resizing should be both on width and height of the buttons but it can shrink up to a given size.

The thing that I do not understand how to do, is to be able to grow/shrink both sides in width without covering each other.
So how do I do it properly ?

Thanks,
Ido

http://ik.homelinux.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100223/624e1594/attachment.html>

Reply by email

Duncan Parsons
to ik

I think you'd have to write custom code on the resize event to scale the dimensions. Keep in mind - do all the scaling from constants relating to a known size of the form that works - doing it on deltas/ last recorded size will cause an eventual creep north-west with rounding errors.

I don't believe there is an easy way to do it with anchors.

HTH
DSP

________________________________

Earlier message 23 lines
From: ik [mailto:] Sent: 23 February 2010 08:53 To: Lazarus mailing list Subject: [Lazarus] question in Button Alignment Hello, I wish to create a component that gives 10 buttons aligning 5 buttons on each side. The thing is, that I want to make both sides resize using anchors or something like that. The resizing should be both on width and height of the buttons but it can shrink up to a given size. The thing that I do not understand how to do, is to be able to grow/shrink both sides in width without covering each other. So how do I do it properly ? Thanks, Ido http://ik.homelinux.org/

Reply by email

Mattias Gärtner
to Duncan Parsons

Zitat von Duncan Parsons :

Show quoted text 11 lines
[...] I wish to create a component that gives 10 buttons aligning 5 buttons on each side. The thing is, that I want to make both sides resize using anchors or something like that. The resizing should be both on width and height of the buttons but it can shrink up to a given size. The thing that I do not understand how to do, is to be able to grow/shrink both sides in width without covering each other. So how do I do it properly ?

Layout=cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine=5
EnlargeHorizontal=crsScaleChilds

Mattias

Reply by email

Duncan Parsons
to Mattias Gärtner

From: Mattias G?rtner [mailto:]
Sent: 23 February 2010 11:43
To:
Subject: Re: [Lazarus] qurstion in Button Alignment

Zitat von Duncan Parsons :

Show quoted text 11 lines
[...] I wish to create a component that gives 10 buttons aligning 5 buttons on each side. The thing is, that I want to make both sides resize using anchors or something like that. The resizing should be both on width and height of the buttons but it can shrink up to a given size. The thing that I do not understand how to do, is to be able to grow/shrink both sides in width without covering each other. So how do I do it properly ?

Layout=cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine=5
EnlargeHorizontal=crsScaleChilds

Mattias
=-=-=

Oh, very good ;-)

DSP

Reply by email

ik
to Mattias Gärtner: Zitat von Duncan Parsons : Layout=cclTopToBottomThenLeftToRight…

2010/2/23 Mattias G?rtner

Show quoted text 20 lines
Zitat von Duncan Parsons : [...] > > I wish to create a component that gives 10 buttons aligning 5 buttons on > each side. > The thing is, that I want to make both sides resize using anchors or > something like that. > The resizing should be both on width and height of the buttons but it > can shrink up to a given size. > > The thing that I do not understand how to do, is to be able to > grow/shrink both sides in width without covering each other. > So how do I do it properly ? > Layout=cclTopToBottomThenLeftToRight ChildSizing.ControlsPerLine=5 EnlargeHorizontal=crsScaleChilds

Thanks I'll try it out.

Show quoted text 14 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Ido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100223/4873273e/attachment-0001.html>

Reply by email

ik
to ik
ik wrote 26 lines
2010/2/23 Mattias G?rtner > Zitat von Duncan Parsons : > > > [...] >> >> I wish to create a component that gives 10 buttons aligning 5 buttons on >> each side. >> The thing is, that I want to make both sides resize using anchors or >> something like that. >> The resizing should be both on width and height of the buttons but it >> can shrink up to a given size. >> >> The thing that I do not understand how to do, is to be able to >> grow/shrink both sides in width without covering each other. >> So how do I do it properly ? >> > > Layout=cclTopToBottomThenLeftToRight > ChildSizing.ControlsPerLine=5 > EnlargeHorizontal=crsScaleChilds > Thanks I'll try it out.

It works, however the height of the buttons are very small, and I can't change it.
Is there a way to scale the height (I don't mind the width with it) ?

Show quoted text 20 lines
> > > Mattias > > > > > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > Ido

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20100225/5de00708/attachment-0001.html>

Reply by email

Mattias Gaertner
to ik
Show quoted text 31 lines
On Tue, Feb 23, 2010 at 21:02, ik wrote: > 2010/2/23 Mattias G?rtner > >> Zitat von Duncan Parsons : >> >> >> [...] >>> >>> I wish to create a component that gives 10 buttons aligning 5 buttons on >>> each side. >>> The thing is, that I want to make both sides resize using anchors or >>> something like that. >>> The resizing should be both on width and height of the buttons but it >>> can shrink up to a given size. >>> >>> The thing that I do not understand how to do, is to be able to >>> grow/shrink both sides in width without covering each other. >>> So how do I do it properly ? >>> >> >> Layout=cclTopToBottomThenLeftToRight >> ChildSizing.ControlsPerLine=5 >> EnlargeHorizontal=crsScaleChilds >> > > Thanks I'll try it out. > It works, however the height of the buttons are very small, and I can't change it. Is there a way to scale the height (I don't mind the width with it) ?

Have you set the Buttons AutoSize to true?

You can also set the Buttons Constraints.MinHeight to some value (e.g. 25).

Mattias

Reply by email