Board index » cppbuilder » Problem with Splitter and MDI

Problem with Splitter and MDI


2006-03-02 06:27:59 AM
cppbuilder79
Hi,
I am trying to use a Splitter on an MDI main form but it paints a copy of
itself elsewhere on the form. This problem is very easy to reproduce as
follows:
1. Create new MDI app with File/New/Other... Projects/MDI Application.
2. Place a Panel and set Align to alTop.
3. Place a Splitter and set Align to alTop and also set the Splitter's Color
property to clLime (or other load color).
4. Run the app and you will see 2 splitters, one in the correct place and
one further down the form.
Strangely, if you move the true splitter a small amount the copy moves too,
but if you move it past the copy, the copy is now gone! (until the form next
repaints itself)
Does anyone know a workaround / fix for this problem?
Thanks
Cliff
I am using BCB 6.0 Build 10.166
 
 

Re:Problem with Splitter and MDI

"Cliff" < XXXX@XXXXX.COM >wrote in message
Quote
I am trying to use a Splitter on an MDI main form but it paints a copy of
itself elsewhere on the form. This problem is very easy to reproduce as
follows:
Looks like a bug was introduced in BCB 6 when using TSplitter with MDI.
BCB5 does not suffer from this issue.
Gambit
 

Re:Problem with Splitter and MDI

Hi Cliff, as Remy has said, this is defiantly a bug, it's been mentioned
several times before and a few code examples have been given to try and
overcome this. I spend quite a few hours try to resolve this problem and
trying to get bug fix's to work, to no avail. I then want down the path of
look at 3rd-party VCL's to do the same job, before finally overcoming the
problem using a simple panel...
As crazy as this TPanel option should, it works remarkably well. I simply
placed a panel on the MDI parent, and set its properties thus:
Aling = alLeft;
Alignment = caCentre;
Anchors = [alLeft,akTop,akBottom];
BevelWidth = 1;
BorderStyle = 0;
Caption = "";
Cursor = crSizeWE;
then on the panels OnMouseMove event I coded thus:
void __fastcall TMainForm::panSplitterMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
if ((Shift.Contains(ssLeft))&&(LeftPan->Visible))
{
Left->Width = LeftPan->Width + X;
}
}
- where LeftPan is the panel that I'm trying to resize - this could be any
control that your trying to resize though
Thought this might help - it works perfectly for me.
"Cliff" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,
I am trying to use a Splitter on an MDI main form but it paints a copy of
itself elsewhere on the form. This problem is very easy to reproduce as
Cliff

I am using BCB 6.0 Build 10.166

 

{smallsort}

Re:Problem with Splitter and MDI

Thanks Mike
Your idea works great for me too. Why didn't I think of that rather than
pulling my hair out trying to get the splitter to work?
Cheers
Cliff
"Mike Collins" < XXXX@XXXXX.COM >wrote in message
Quote
Hi Cliff, as Remy has said, this is defiantly a bug, it's been mentioned
several times before and a few code examples have been given to try and
overcome this. I spend quite a few hours try to resolve this problem and
trying to get bug fix's to work, to no avail. I then want down the path
of look at 3rd-party VCL's to do the same job, before finally overcoming
the problem using a simple panel...

As crazy as this TPanel option should, it works remarkably well. I simply
placed a panel on the MDI parent, and set its properties thus:
Aling = alLeft;
Alignment = caCentre;
Anchors = [alLeft,akTop,akBottom];
BevelWidth = 1;
BorderStyle = 0;
Caption = "";
Cursor = crSizeWE;

then on the panels OnMouseMove event I coded thus:

void __fastcall TMainForm::panSplitterMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
if ((Shift.Contains(ssLeft))&&(LeftPan->Visible))
{
Left->Width = LeftPan->Width + X;
}
}

- where LeftPan is the panel that I'm trying to resize - this could be any
control that your trying to resize though

Thought this might help - it works perfectly for me.


"Cliff" < XXXX@XXXXX.COM >wrote in message
news:44061fef$ XXXX@XXXXX.COM ...
>Hi,
>I am trying to use a Splitter on an MDI main form but it paints a copy of
>itself elsewhere on the form. This problem is very easy to reproduce as

>Cliff
>
>I am using BCB 6.0 Build 10.166
>