Sign in Join

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

Mailing lists / lazarus / 2009-11

2 questions about Component properties

7 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Mattias Gaertner
to wile64
Hi, 1) I search to resize component when he load, like autosize but with my parameters ?

Do you search properties to define the autosizing (Anchors, Align, BorderSpacing, ChildSizing), or do you want to implement your own autosizing (OnResize event)?

2) How to define region for accept client into Tpanel ?

Maybe you mean the properties listed in the object inspector under ChildSizing? For example LeftRightSpacing.

Mattias

Reply by email

wile64
to Mattias Gaertner

2009/12/1 Mattias Gaertner

Show quoted text 12 lines
On Mon, 30 Nov 2009 16:33:34 +0100 wile64 wrote: > Hi, > > 1) I search to resize component when he load, like autosize but with my > parameters ? Do you search properties to define the autosizing (Anchors, Align, BorderSpacing, ChildSizing), or do you want to implement your own autosizing (OnResize event)?

Height is stored in design, on run-time, I search to redefine Height when loading component,

I make solution like this, Height stored = false and I save Height in other variable!
I'm not sure is good solution ?

Show quoted text 8 lines
> 2) How to define region for accept client into Tpanel ? Maybe you mean the properties listed in the object inspector under ChildSizing? For example LeftRightSpacing.

AdjustClientRect work with anchoring, but in designer is not respected. It is possible to restrict area for client in design and run time too ?

Show quoted text 9 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Laurent. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091201/15c2ae08/attachment.html>

Reply by email

Mattias Gaertner
to wile64
Show quoted text 17 lines
2009/12/1 Mattias Gaertner > On Mon, 30 Nov 2009 16:33:34 +0100 > wile64 wrote: > > > Hi, > > > > 1) I search to resize component when he load, like autosize but with my > > parameters ? > > Do you search properties to define the autosizing (Anchors, Align, > BorderSpacing, ChildSizing), or do you want to implement your own > autosizing (OnResize event)? > Height is stored in design, on run-time, I search to redefine Height when loading component,

Yes, that's called autosizing. You can use the LCL properties or you can use OnResize.
For the Height of the Form itself you can use OnCreate or OnShow.

I make solution like this, Height stored = false and I save Height in other variable!

Height is stored by the LCL. You can not set stored = false (unless you change the LCL source code).

I'm not sure is good solution ?

Can you give some more details, what you want to do?

Show quoted text 8 lines
> > 2) How to define region for accept client into Tpanel ? > > Maybe you mean the properties listed in the object > inspector under ChildSizing? For example LeftRightSpacing. > > AdjustClientRect work with anchoring, but in designer is not respected. It is possible to restrict area for client in design and run time too ?

AdjustClientRect work the same under designtime and runtime. Under designtime you can drag the controls to some invalid positions, same as at runtime. The only difference is that at runtime the autosizing is done immediately, so you can not see the invalid positions. Same for Anchors.

Mattias

Reply by email

wile64
to Mattias Gaertner

2009/12/1 Mattias Gaertner

Show quoted text 27 lines
On Tue, 1 Dec 2009 13:55:32 +0100 wile64 wrote: > 2009/12/1 Mattias Gaertner > > > On Mon, 30 Nov 2009 16:33:34 +0100 > > wile64 wrote: > > > > > Hi, > > > > > > 1) I search to resize component when he load, like autosize but with my > > > parameters ? > > > > Do you search properties to define the autosizing (Anchors, Align, > > BorderSpacing, ChildSizing), or do you want to implement your own > > autosizing (OnResize event)? > > > > Height is stored in design, on run-time, I search to redefine Height when > loading component, Yes, that's called autosizing. You can use the LCL properties or you can use OnResize. For the Height of the Form itself you can use OnCreate or OnShow. It's a custom panel.
Show quoted text 14 lines
> I make solution like this, Height stored = false and I save Height in other > variable! Height is stored by the LCL. You can not set stored = false (unless you change the LCL source code). > I'm not sure is good solution ? Can you give some more details, what you want to do? Roll up panel with title
Show quoted text 17 lines
> > > 2) How to define region for accept client into Tpanel ? > > > > Maybe you mean the properties listed in the object > > inspector under ChildSizing? For example LeftRightSpacing. > > > > > AdjustClientRect work with anchoring, but in designer is not respected. > It is possible to restrict area for client in design and run time too ? AdjustClientRect work the same under designtime and runtime. Under designtime you can drag the controls to some invalid positions, same as at runtime. The only difference is that at runtime the autosizing is done immediately, so you can not see the invalid positions. Same for Anchors. Yes, but when add button for exemple, is possible to put out of marging

defined in AdjustClientRect

Show quoted text 8 lines
Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Laurent. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091202/a2f22a8c/attachment.html>

Reply by email

Mattias Gaertner
to wile64
Show quoted text 36 lines
[...] > It's a custom panel. > > > I make solution like this, Height stored = false and I save Height in > other > > variable! > > Height is stored by the LCL. You can not set stored = false (unless > you change the LCL source code). > > > > I'm not sure is good solution ? > > Can you give some more details, what you want to do? > > Roll up panel with title > > > > > 2) How to define region for accept client into Tpanel ? > > > > > > Maybe you mean the properties listed in the object > > > inspector under ChildSizing? For example LeftRightSpacing. > > > > > > > > AdjustClientRect work with anchoring, but in designer is not respected. > > It is possible to restrict area for client in design and run time too ? > > AdjustClientRect work the same under designtime and runtime. Under > designtime you can drag the controls to some invalid positions, same as > at runtime. The only difference is that at runtime the autosizing is > done immediately, so you can not see the invalid positions. Same for > Anchors. > > Yes, but when add button for exemple, is possible to put out of marging defined in AdjustClientRect

Yes, even negative coordinates are allowed for controls. This is for example needed when right aligning controls and the panel has not enough width for all it's children.
You can override

    procedure AlignControls(AControl: TControl; var ARect: TRect); override;

This is called whenever the children were changed.

Mattias

Reply by email

wile64
to Mattias Gaertner
Show quoted text 13 lines
> > Yes, but when add button for exemple, is possible to put out of marging > defined in AdjustClientRect Yes, even negative coordinates are allowed for controls. This is for example needed when right aligning controls and the panel has not enough width for all it's children. You can override procedure AlignControls(AControl: TControl; var ARect: TRect); override; This is called whenever the children were changed. Mattias

Thanks Mattias, I see that.

Laurent. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20091208/c35f2dd8/attachment.html>

Reply by email