Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing TSplitter position in code?

0 views
Skip to first unread message

Bradley D. Stowers

unread,
Jul 24, 1998, 3:00:00 AM7/24/98
to
Is it just me, or is there really no good way of changing the position of a
TSplitter component (D3 or D4) in code?

The only way I've found is by changing the Align properties of the splitter
and the two controls it splits to alNone and then moving the splitter (using
Top or Left property) and then resetting all the Align properties. That works
fine for the app I did it in since the app knows about all the things
involved, but I'm writing a TSplitter descendant component now, and it's not
very practical to try and figure out the other controls involved from within
the component (those routines and variables are all declared private; thanks
Borland).

Anyway, you'd think the splitter would be smart enough to handle something
like:

Top := 20;

to move itself and reposition the split controls, but that doesn't work.

Someone please tell me I'm missing something obvious here.


Regards,
Brad Stowers
Delphi Free Stuff
http://www.pobox.com/~bstowers/delphi/

Mike Orriss

unread,
Jul 24, 1998, 3:00:00 AM7/24/98
to
In article <35b979a1....@forums.borland.com>, Bradley D. Stowers wrote:
> That works
> fine for the app I did it in since the app knows about all the things
> involved, but I'm writing a TSplitter descendant component now, and it's not
> very practical to try and figure out the other controls involved from within
> the component (those routines and variables are all declared private; thanks
> Borland).
>

Why not?

The splitter normally resides between controls aligned client and aligned to
one of the sides. If you iterate through the splitter's parent's controls, you
can find the correct control to change width or height etc, as appropriate.


Mike Orriss (m...@3kcc.co.uk)
http://www.3kcc.co.uk/notetree.htm


Dave Horacek

unread,
Jul 27, 1998, 3:00:00 AM7/27/98
to
Bradley D. Stowers wrote in message
<35b979a1....@forums.borland.com>...

>Is it just me, or is there really no good way of changing the position
of a
>TSplitter component (D3 or D4) in code?
>
>The only way I've found is by changing the Align properties of the
splitter
>and the two controls it splits to alNone and then moving the splitter
(using
>Top or Left property) and then resetting all the Align properties.
That works
>fine for the app I did it in since the app knows about all the things
>involved, but I'm writing a TSplitter descendant component now, and
it's not
>very practical to try and figure out the other controls involved from
within
>the component (those routines and variables are all declared private;
thanks
>Borland).
>
>Anyway, you'd think the splitter would be smart enough to handle
something
>like:
>
> Top := 20;
>
>to move itself and reposition the split controls, but that doesn't
work.
>
>Someone please tell me I'm missing something obvious here.
>


All the splitter does is adjust the height or width of the control that
is edge aligned the same as the TSplitter and lets the control aligned
to alClient fill in the empty space. Responding to being drug around is
the hard part.

So if you know what position you want the splitter located then you also
know how high or wide the edge aligned control should be. Using the
Parent property, search for the TControl that is adjacent to and edge
aligned like the TSplitter and set the height of that control.

Dave H.


0 new messages