Zitat von Michael Van Canneyt <[email protected]>:
On Tue, 6 Apr 2010, Mattias Gärtner wrote:
Zitat von Michael Van Canneyt <[email protected]>:
[...]
I would use a mechanism similar to the datalink. As soon as you tell the
layout manager to manage a certain control, a hook is installed in the
control.
And where is the hook stored?
In TWinControl, protected or even private.
And how to find out which layout a control uses?
The control has no need to know which layout it uses.
How can a designer tool find out what layout a control uses?
It just needs to know that it must handle positioning/sizing over to
the layout.
(through the hook).
[...]
Then don't publish it for TEdit.
Btw, even a TEdit can need a layout to store extra properties, for
autosizing itself, for special docking, for alignment or for
designer specials.
I don't believe this should be so. If this is so, then the layouting
is badly designed.
How would you do that?
For example you want a group of TEdits to position/resize according to
a policy, so you set for all your edits a layouter.
I understand this, I thought of this also. But I think it is more
clean if the hook is hidden completely; This
way one cannot 'forget' to publish it or publish it when it is not
needed.
Finally, it doesn't really matter. To my taste, my solution is cleaner.
Opinions may vary on what 'clean' is, of course :-)
Your solution seems somewhat limited to the ExtJS layouts.
Maybe, but it has the advantage of being very clear and simple.
And I think clarity is a virtue, for which I am prepared to sacrifice
a few corner cases.
Counter example:
When I first suggested to extend the Anchors I only suggested a simple
anchor to one control. AFAIR it was Marc who said, we should do that
for each side. I thought: This is only useful for a very few corner
cases. Nowadays we use this feature at hundreds of places in the IDE.
I'm very glad that Marc had the foresight.
Currently, the layouting is simply a mess, with added ad-hoc properties
and no clear rules that determine which property has precedence over
other properties.
See here:
http://wiki.lazarus.freepascal.org/Autosize_/_Layout
Mattias
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus