BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Incorrect resize

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage)
View previous topic :: View next topic  
Author Message
Analian
Guest





PostPosted: Tue Mar 29, 2005 8:55 am    Post subject: Incorrect resize Reply with quote



I've got a Panel with two Charts in it
I want Chart3 to stay on the bottom of Panel3 and with subsequent clicks of
Button1 to change Chart2's states
between visible and invisible. Thus I want the Panel to resize and shrink to
Chart2's Height when Chart3's invisible and then go back to the Height of
both Charts when both are visible.
The following code I guess is supposed to change the Height of the panel and
preserve the desired alignment of the
two Charts but something's not ok. Any ideas on this matter? Thank you.

void TForm1::HideChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 0;
Panel3->Height = Chart3->Height + 2 * Panel3->BevelWidth;
Chart3->Align = alBottom;
Chart2->Align = alClient;
}

void TForm1::ShowChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 1;
Panel3->Height = Chart3->Height + Chart2->Height + 2 *
Panel3->BevelWidth;
Chart3->Align = alBottom;
Chart2->Align = alClient;
Chart2->Top = 0;
Chart3->Top = Chart2->Height;
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
if (Chart2->Visible)
HideChart();
else
ShowChart();
}


Back to top
Hans Galema
Guest





PostPosted: Tue Mar 29, 2005 9:22 am    Post subject: Re: Incorrect resize Reply with quote



Analian wrote:
Quote:
I've got a Panel with two Charts in it
I want Chart3

Please use Chart1 and Chart2 if you have two of them.

Quote:
to stay on the bottom of Panel3 and with subsequent clicks of
Button1 to change Chart2's states
between visible and invisible. Thus I want the Panel to resize and shrink to
Chart2's Height when Chart3's invisible and then go back to the Height of
both Charts when both are visible.
The following code I guess is supposed to change the Height of the panel and
preserve the desired alignment of the
two Charts but something's not ok.

Please tell us first what is not ok.

Quote:
Any ideas on this matter? Thank you.

void TForm1::HideChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 0;

Chart2->Visible = false;

Quote:
Panel3->Height = Chart3->Height + 2 * Panel3->BevelWidth;
Chart3->Align = alBottom;
Chart2->Align = alClient;

Do not toucht the alignment of Chart2. It is not even visible!

Quote:
}

void TForm1::ShowChart() {
Chart2->Align = alNone;
Chart3->Align = alNone;
Chart2->Visible = 1;

Chart2->Visible = true;

Quote:
Panel3->Height = Chart3->Height + Chart2->Height + 2 *
Panel3->BevelWidth;

Here you take Chart2->Height were it was first aligned alBottom
and then al None. What do you expect it's Heigth to be now ?

Quote:
Chart3->Align = alBottom;
Chart2->Align = alClient;
Chart2->Top = 0;
Chart3->Top = Chart2->Height;

Only the first two of these fout statements should do.
But why all these aligning ? Just change the Top of the lower
Chart. That's all.

Hans.

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Usage) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.