Board index » cppbuilder » Re: TTabSheet: What's wrong with this simple code?

Re: TTabSheet: What's wrong with this simple code?


2003-12-13 08:53:16 PM
cppbuilder88
Hi,
I have reproduced the problem and can't make any sense out of it.
However, concerning your original problem:
I remember that I had a similar problem where I had to remote-control
TabSheets and noticed that the initially invisible sheets had not yet
created their child controls. I solved the problem by activating each
sheet in a loop.
Why do you need to set the Visible property? Couldn't you just
making each sheet the ActivePage in a loop and then go back to the
first?
regards,
Nick
 
 

Re:Re: TTabSheet: What's wrong with this simple code?

First or all, thanks for the post.
Quote
I have reproduced the problem and can't make any sense out of it.
Neither do I.
Quote
However, concerning your original problem:
I remember that I had a similar problem where I had to remote-control
TabSheets and noticed that the initially invisible sheets had not yet
created their child controls. I solved the problem by activating each
sheet in a loop.
I also have (silly) fragments of code like this:
for ( int i=0; i<PageControl->PageCount; i++ )
PageControl->Pages[i]->Visible = true;
PageControl->ActivePage = PageControl->Pages[ item ];
Quote
Why do you need to set the Visible property?
This is the central point of the problem. I think that a programmer can
do it's job for years and not to have any need to use Visible property
of TabSheet. I also haven't any need for using Visible property till
a day when I notoced that some (maybe problematic) function that is
triggered by a couple of Button's (every stored in other TabSheet)
generates 'Acces Violation' in any case except if I (before use)click (?!)
all of them first.
That means if I want to avoid 'Access Violation' I have to click
TabSheet1, TabSheet2, ... , TabSheetN, and then I can click Buttons
and call and use the problematic function as long as I want.
Quote
Couldn't you just
making each sheet the ActivePage in a loop and then go back to the
first?
... and then I dug to find a way to programmatically reproduce the
situation I alredy clicked all tabs before first use. I think you agree
that I cannot request my clients to click all the TabSheets before first use
:)
The temporary solution was:
for ( into i=0; i<PageControl->PageCount; i++ )
PageControl->Pages[i]->Visible = true;
This code behaved exactly as I needed, BUT it produced the second
problem as I sad in my initial post (there is a example):
'Button2' appeared on 'TabSheet1' !?
That means the contents of the last TabSheet appeared on the first TabSheet.
That made me mad. I have to rest for a while :)
I'm now checking the (problematic) function that raises the 'Access
Violation'.
Why do I say problematic? Because it's a window called from DLL that was
made by VC++ and called through SendMessage( ... ) mechanism.
But how can the function work at all if it's not valid? I'll try to test the
problem with some other control than PageControl with TabSheets and than
I'll know is it a PageControl or a function problem.
Vladimir.
 

Re:Re: TTabSheet: What's wrong with this simple code?

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote in message
Quote
I also have (silly) fragments of code like this:
You should not be setting the Visible property of a TabSheet to begin with.
If you want to hide a TabSheet, simply change the ActivePage to a different
TabSheet. If you don't want the user to access the "hidden" TabSheet, then
set its TabVisible property to false instead. There is no reason to set a
TabSheet Visible property itself.
Gambit
 

{smallsort}