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 

TPageControl & OnChange problems

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





PostPosted: Sun Jun 26, 2005 9:56 pm    Post subject: TPageControl & OnChange problems Reply with quote



Hi all, having a bit of a problem with a TPageControl. Basically I have a
PageControl with 8 tabsheets on it and an OnChange event coded, for the
PageControl, that make some display alterations depending on which tab is
active. When the form is first created I set the ActivePage to the first
tabsheet (which it isn't at design time) using the code
pgcWizard->ActivePage = tbsIntro; where tbsIntro is the first tabsheet.
However the OnChange event doesn't seem to fire, the first page is displayed
but the OnChange code isn't executed. I've tried placing the code in the
FormShow but still no joy. Once displayed, if I click on the various tabs
the code gets executed but not is I set the ActivePage myself

Any ideas?


Back to top
salamander1965
Guest





PostPosted: Mon Jun 27, 2005 1:28 am    Post subject: Re: TPageControl & OnChange problems Reply with quote



Mike Collins wrote:
Quote:
When the form is first created I set the ActivePage to the first
tabsheet (which it isn't at design time) using the code
pgcWizard->ActivePage = tbsIntro; where tbsIntro is the first tabsheet.

Any reason you can't make tbsIntro the active page at design time?

Quote:
However the OnChange event doesn't seem to fire, the first page is displayed
but the OnChange code isn't executed.

I think that some events aren't necessarily triggered when you might
expect them to be -- eg, programmatic vs. user actions don't always
result in the same events being triggered.

Quote:
Once displayed, if I click on the various tabs
the code gets executed but not is I set the ActivePage myself


If you can set tbsIntro at design time, you should be OK. I'm assuming
that if you switch to another tab (triggering OnChange) and then switch
back to tbsIntro, you get the OnChange as you should.

-- S.


Back to top
Kent
Guest





PostPosted: Mon Jun 27, 2005 2:47 am    Post subject: Re: TPageControl & OnChange problems Reply with quote



Mike,

Try forcing the OnChange event with a direct call in
FormShow or another more suitable location like so:

PageControl1Change(NULL);

Kent


Back to top
Mike Collins
Guest





PostPosted: Mon Jun 27, 2005 9:15 am    Post subject: Re: TPageControl & OnChange problems Reply with quote

Yeh, thats how I'm doing it at present, but it seems like a bit of a hack.
Obviously I could set the tabsheet at design time, but it doesn't follow
with my design (I'm basically creating a wizard so you never see the tabs
anyway). Would be helpful if the help files provided a bit more
information, like this event is only fired in responce to a user clicking on
a tab, and will not be fired if the tabsheet is activated programmablly :-)


"Kent" <kentav (AT) accessus (DOT) net> wrote

Quote:
Mike,

Try forcing the OnChange event with a direct call in
FormShow or another more suitable location like so:

PageControl1Change(NULL);

Kent





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.