Not quite like that.  Every TPageControl except the left most
(pcConversations) has its align property set to alRight, and each of them
has an associated splitter width=3, positioned just to left of the
TPageControl.  That's how the program starts running.  Visually, the panels
are as shown below:


[pcConversations]spDetails[pcDetails]spObjects[pcObjects]spActions[pcActions
]

Where the Hungarian prefix "sp" is for splitter, and "pc" is for
PageControl.  

While the program is running, I want to let my user make any of the
TPageControls visible or not visible in any combination.  But when I turn
off one page control's visible property, it gets positioned somewhere away
from its original position.  Then when I turn it visible again, its
associated splitter has moved, and no longer fulfills the function of
adjusting the TPageControl's width, since it is no longer just to the left
of the TPageControl.  

Here is some code that turns ALL TPageControls off and on at the same time,
in right to left order:

procedure TurnOffAllPageControls;  {in left to right order}
begin
  fmConversation.pcConversations.Align := alNone;
  fmConversation.spDetails.Align       := alNone;
  fmConversation.pcDetails.Align       := alNone;
  fmConversation.spDetails.Visible     := False;
  fmConversation.pcDetails.Visible     := False;

  fmConversation.spObjects.Align       := alNone;
  fmConversation.pcObjects.Align       := alNone;
  fmConversation.spObjects.Visible     := False;
  fmConversation.pcObjects.Visible     := False;

  fmConversation.spActions.Align       := alNone;
  fmConversation.pcActions.Align       := alNone;
  fmConversation.spActions.Visible     := False;
  fmConversation.pcActions.Visible     := False;
end;

procedure TurnOnAllPageControls;   {in right to left order}
begin
  fmConversation.pcActions.Left        := fmConversation.Width-16;
  fmConversation.pcActions.Align       := alRight;
  fmConversation.pcActions.Visible     := True;

  fmConversation.spActions.Align       := alRight;
  fmConversation.spActions.Visible     := True;

  fmConversation.pcObjects.Align       := alRight;
  fmConversation.pcObjects.Visible     := True;

  fmConversation.spObjects.Align       := alRight;
  fmConversation.spObjects.Visible     := True;

  fmConversation.pcDetails.Align       := alRight;
  fmConversation.pcDetails.Visible     := True;

  fmConversation.spDetails.Align       := alRight;
  fmConversation.spDetails.Visible     := True;

  fmConversation.pcConversations.Align := alClient;
end;

As long as I turn them all off in right to left order, then all on in right
to left order, everything stays ok.  But when I turn just one pc off, it
gets moved because the other pcs to the left of it get adjusted due to the
alRight setting of all the pc and sp components.  

What I need is a design concept that lets me adjust the position of each
page control and its associated splitter.  I'm still working on defining
that concept.  

-Rich 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Robert Meek
Sent: Thursday, May 08, 2008 8:13 PM
To: 'Delphi-Talk Discussion List'
Subject: RE: Splitters and PageControls

        If I'm reading this correctly, you have a form which is divided into
3 panes.   The left-most ConversationPane is always visible and is set to
alLeft and of a width that is pre-set to always be the same.  Then you have
a splitter set to alRight with its top and left anchors set to always meet
the right-edge of the left-most ConversationsPane. In the splitter's
right-most panel you have set to alClient an ActionsPane,  You then say that
in the splitter's left-pane you repeat this setup for an ObjectsPane, yet
this would infer that you have added a whole new splitter to the first
splitter's left pane and set to alClient, and with the ObjectsPane set to
alClient in the second Splitter's left-most Panel!

        I know this cannot be correct because it is not only redundant, but
of no real use in anyway I can figure out no matter which of these "panes"
are PageControls or some other component types!

        So perhaps THIS is what you are trying to describe:

        A Form on which you have added a Splitter set to alClient.  In its
left-most pane you have added a second Splitter set to alClient as well.  In
the Splitter's right-most pane you have added a pageControl set to alClient.
In the second Splitter's left-most pane you have added a PageControl set to
alClient, and in its right-most pane another PageControl set to alClient as
well.  The PageControls named from left to right appear as pcConversations,
pcObjects, and pcActions.  Depending upon events controlled from a popup
menu on the pcConversations PageControl, you wish for one or both of the
other two PageControls to be visible or not simultaneously, while the
pcConversations PageControl is always visible and static down to a min Width
Contraint.
        More than likely I would want the Form itself not to ever change
it's width based upon any particular PageControl being visible or not, as
that is confusing to the user's eyes.  Instead, I would want the
pcConversations PageControl to increase in width via increasing the
secondary Splitter's left-most Pane being increased in width as required
when ever one or both of the other two PageControls are made invisible.
        So the way I would handle this is to reset the second Splitter's
Percentage to 100% or to its max position so as it make its left-most pane
and the pcConversations PageControl as wide as possible whenever the
pcObjects PageControl must disappear which can be accomplished simply by
altering its Splitter's position or percentage as just stated.  I would do
exactly the same thing to the Position or Percentage of the original
Splitter when ever the pcActions pane needs to disappear as well.  This
makes each one independent of the other so that they can be made to
disappear and/or re-appear in whatever order and/or sequence the user wants,
and to cause the pcConversations PageControl to react by getting wider or
thinner as needed to fill in the addition empty space or allow for the
additionally needed space depending upon how the other two PageControls are
altered and without having to worry about the possibility that the Form
itself may have had its own width changed between any of the events!
        Note:  As I've used this same technique myself, depending upon the
Splitter type and brand you are employing, and also on how you have it's
borders and/or frames setup visually, you may need to play around with these
settings as you click on these events so as to make things appear as "clean"
as possible.  What I have had to do in the past was actually make the
Splitter bar width 0 when set to its max position and then to its default
width again when resized to make both its panes visible again otherwise they
often look clumsy all at one side!
        HTH's    

from Robert Meek dba "Tangentals Design"
e-mail: [EMAIL PROTECTED]
Freelance Windows Programming for XP and Vista 
Also proud to be a Moderator of the "Delphi-List" at elists.org

"Reality cannot be explained...only enjoyed or endured as your current
perspective allows!"

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Rich Cooper
Sent: Thursday, May 08, 2008 3:53 PM
To: 'Delphi-Talk Discussion List'
Subject: Splitters and PageControls

Hi All,

I have a form with three PageControls on it.  The one on the left
(pcConversations) is always visible.  There is a menu which lets the user
check or uncheck whether the other two PageControls are visible.  Those two
PageControls are called pcActions and pcObjects.  pcActions is on the right
side of the form, align=alRight, and there is a splitter (spActions) with
align=alRight flush on the left side of pcActions.  The same structure is
used for pcObjects (just to the left of spActions and pcActions) and
spObjects (just to the left of pcObjects).  

Now I want to write the handlers for the 'checked' property of the two menu
items <View | Objects> and <View | Actions>.  Here is the first attempt at
writing these handlers:

procedure TfmConversation.Objects1Click(Sender: TObject);
begin
  Objects1.Checked  := not Objects1.Checked;
  spObjects.Left    := pcObjects.Left-7;
  spActions.Left    := pcActions.Left-7;
  pcObjects.Visible := Objects1.Checked;
end;

procedure TfmConversation.Actions1Click(Sender: TObject);
begin
  Actions1.Checked  := not Actions1.Checked;
  spActions.Left    := pcActions.Left-7;
  spObjects.Left    := pcObjects.Left-7;
  pcActions.Visible := Actions1.Checked;
end;

The problem is that the splitters and the PageControls don't stay in the
right places.  If I make pcActions.visible=false and pcObjects.visible=false
(by using the checks in the menu) everything is OK.  But then when I bring
them back to visible (again by using menu checks), they are in the wrong
place.  

Does anyone know how to handle turning the PageControls and splitters
visible and back to invisible without changing the left to right order of
the components on the form?

Thanks for any comments,
Rich




__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk


__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-talk

Reply via email to