By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,997 Members | 1,470 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,997 IT Pros & Developers. It's quick & easy.

tab control and tab changed

P: n/a
I would like for when a tab page changes, that my controls on the previous
tab page would receive a visiblechanged event or some other event so they
are aware of that. We have db locks in some of our controls when they're
visible and so if a tab page is changed, I would like for the control to
know it's no longer visible and release that lock. Currently that doesn't
happen. Does anybody have any suggestions and/or is this a bug?

Lance Johnson
Nov 15 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Use TabControl.SelectedIndexChanged event.

"Lance Johnson" <lj******@docs.com> wrote in message
news:uJ*************@TK2MSFTNGP09.phx.gbl...
I would like for when a tab page changes, that my controls on the previous
tab page would receive a visiblechanged event or some other event so they
are aware of that. We have db locks in some of our controls when they're
visible and so if a tab page is changed, I would like for the control to
know it's no longer visible and release that lock. Currently that doesn't
happen. Does anybody have any suggestions and/or is this a bug?

Lance Johnson

Nov 15 '05 #2

P: n/a
"Lance Johnson" <lj******@docs.com> wrote:
Use TabControl.SelectedIndexChanged event.


I'm well aware of that event, however that does me
no good for notifying my client controls for the
previous tab. I'd rather not use the workaround of
remembering the last tab page manually.


When SelectedIndexChanged occurs, you could use a foreach statement to
iterate over the TabPages in your TabControl and disable the controls on any
TabPage that isn't the currently selected one.

P.

--
www.CL4.org
Nov 15 '05 #3

P: n/a

Hi Lance,

In SelectedIndexChanged event, you can only get the current selected tab
index.
I think you should get the original tab before changing, then you can loop
through the
controls in the original tab and invoke its related method.

To get the original tab, you can set a static variable to store the
original tab index(at startup its value should be 0).

To loop through the controls on the tab, you can do like this:

foreach(Control c in tabControl1.TabPages[origtabindex].Controls)
{
//invoke your method of the control
}

Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Lance Johnson" <lj******@docs.com>
| References: <uJ*************@TK2MSFTNGP09.phx.gbl>
<#7*************@TK2MSFTNGP10.phx.gbl>
| Subject: Re: tab control and tab changed
| Date: Tue, 26 Aug 2003 15:25:14 -0500
| Lines: 33
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <ux*************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 204.95.153.41
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:179632
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I'm well aware of that event, however that does me no good for notifying
my
| client controls for the previous tab. I'd rather not use the workaround
of
| remembering the last tab page manually. When my client controls are
hidden
| that event should be thrown, which it's not being thrown. As a side note
| I've built in an event handler on my control that attaches to the parent's
| visible changed event so it'll know to hide itself.
|
| Lance Johnson
|
| "Val Savvateev" <vs********@meridium.com_NO_SPAM> wrote in message
| news:%2***************@TK2MSFTNGP10.phx.gbl...
| > Use TabControl.SelectedIndexChanged event.
| >
| > "Lance Johnson" <lj******@docs.com> wrote in message
| > news:uJ*************@TK2MSFTNGP09.phx.gbl...
| > > I would like for when a tab page changes, that my controls on the
| previous
| > > tab page would receive a visiblechanged event or some other event so
| they
| > > are aware of that. We have db locks in some of our controls when
| they're
| > > visible and so if a tab page is changed, I would like for the control
to
| > > know it's no longer visible and release that lock. Currently that
| doesn't
| > > happen. Does anybody have any suggestions and/or is this a bug?
| > >
| > > Lance Johnson
| > >
| > >
| >
| >
|
|
|

Nov 15 '05 #4

P: n/a
I could do that, however what could I call that would allow the control to
know it's not visible any more. If I set control.visible to false that does
nothing, because it's already set to false. That's my #1 problem is that
it's visibility gets set to false without the event occurring.

Lance Johnson

"Paul E Collins" <fi******************@CL4.org> wrote in message
news:bi**********@titan.btinternet.com...
"Lance Johnson" <lj******@docs.com> wrote:
Use TabControl.SelectedIndexChanged event.
I'm well aware of that event, however that does me
no good for notifying my client controls for the
previous tab. I'd rather not use the workaround of
remembering the last tab page manually.


When SelectedIndexChanged occurs, you could use a foreach statement to
iterate over the TabPages in your TabControl and disable the controls on

any TabPage that isn't the currently selected one.

P.

--
www.CL4.org

Nov 15 '05 #5

P: n/a

Hi Lance,

I think you should inherit a new class from your control and custom some
methods
to your control(such as release lock).
Then, in the SelectedIndexChanged event, you can record the last invisable
tab index
and invoke all the related method of the controls in that tab page.
If I still misunderstand you, please do not be hesitated to tell me.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Lance Johnson" <lj******@docs.com>
| References: <uJ*************@TK2MSFTNGP09.phx.gbl>
<#7*************@TK2MSFTNGP10.phx.gbl>
<ux*************@TK2MSFTNGP10.phx.gbl> <bi**********@titan.btinternet.com>
| Subject: Re: tab control and tab changed
| Date: Tue, 26 Aug 2003 16:09:42 -0500
| Lines: 31
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#h**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 204.95.153.41
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:180048
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I could do that, however what could I call that would allow the control to
| know it's not visible any more. If I set control.visible to false that
does
| nothing, because it's already set to false. That's my #1 problem is that
| it's visibility gets set to false without the event occurring.
|
| Lance Johnson
|
| "Paul E Collins" <fi******************@CL4.org> wrote in message
| news:bi**********@titan.btinternet.com...
| > "Lance Johnson" <lj******@docs.com> wrote:
| >
| > > > Use TabControl.SelectedIndexChanged event.
| > >
| > > I'm well aware of that event, however that does me
| > > no good for notifying my client controls for the
| > > previous tab. I'd rather not use the workaround of
| > > remembering the last tab page manually.
| >
| > When SelectedIndexChanged occurs, you could use a foreach statement to
| > iterate over the TabPages in your TabControl and disable the controls on
| any
| > TabPage that isn't the currently selected one.
| >
| > P.
| >
| > --
| > www.CL4.org
| >
| >
|
|
|

Nov 15 '05 #6

P: n/a
I was just hoping there was a easier way of automatically doing this. What
I've done instead is to look at the parent changed event for the control and
subscribe to the Parent's visibility changed event. Seems to work well
enough for me and then all of my derived controls will automatically work
with no extra work on any tab control or anything else I might put them in.

Lance Johnson
"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:ui**************@cpmsftngxa06.phx.gbl...

Hi Lance,

I think you should inherit a new class from your control and custom some
methods
to your control(such as release lock).
Then, in the SelectedIndexChanged event, you can record the last invisable
tab index
and invoke all the related method of the controls in that tab page.
If I still misunderstand you, please do not be hesitated to tell me.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Lance Johnson" <lj******@docs.com>
| References: <uJ*************@TK2MSFTNGP09.phx.gbl>
<#7*************@TK2MSFTNGP10.phx.gbl>
<ux*************@TK2MSFTNGP10.phx.gbl> <bi**********@titan.btinternet.com>
| Subject: Re: tab control and tab changed
| Date: Tue, 26 Aug 2003 16:09:42 -0500
| Lines: 31
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#h**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 204.95.153.41
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:180048 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I could do that, however what could I call that would allow the control to | know it's not visible any more. If I set control.visible to false that
does
| nothing, because it's already set to false. That's my #1 problem is that | it's visibility gets set to false without the event occurring.
|
| Lance Johnson
|
| "Paul E Collins" <fi******************@CL4.org> wrote in message
| news:bi**********@titan.btinternet.com...
| > "Lance Johnson" <lj******@docs.com> wrote:
| >
| > > > Use TabControl.SelectedIndexChanged event.
| > >
| > > I'm well aware of that event, however that does me
| > > no good for notifying my client controls for the
| > > previous tab. I'd rather not use the workaround of
| > > remembering the last tab page manually.
| >
| > When SelectedIndexChanged occurs, you could use a foreach statement to
| > iterate over the TabPages in your TabControl and disable the controls on | any
| > TabPage that isn't the currently selected one.
| >
| > P.
| >
| > --
| > www.CL4.org
| >
| >
|
|
|

Nov 15 '05 #7

P: n/a

Hi Lance,

I can reproduce your problem.
When clicking the tab page, the unvisabled control does not fire
VisibleChanged
event.
I have used Spy++ to watch the control's message when its parent tab page
get
unvisabled, finding that no message generated.

I also found that the control's VisibleChanged event fires go with the
WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED message.
I think the windows implement the control's visable change by changing their
z-order, when the control on the tab page was unvisabled, its absolute
z-order did
not change, but the visable tab page's z-order get up and lay over the
control, so
the VisibleChanged event did not fire.
While click the tab page that contains the control, the control's absolute
z-order needs
get up and VisibleChanged fired.

So you can not use this way of doing what you want, please try some way
that we suggested.
It will work around your problem.

Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Lance Johnson" <lj******@docs.com>
| References: <uJ*************@TK2MSFTNGP09.phx.gbl>
<#7*************@TK2MSFTNGP10.phx.gbl>
<ux*************@TK2MSFTNGP10.phx.gbl> <bi**********@titan.btinternet.com>
<#h**************@TK2MSFTNGP09.phx.gbl>
<ui**************@cpmsftngxa06.phx.gbl>
| Subject: Re: tab control and tab changed
| Date: Mon, 8 Sep 2003 11:24:27 -0500
| Lines: 87
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <OT**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 204.95.153.41
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:183222
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I was just hoping there was a easier way of automatically doing this.
What
| I've done instead is to look at the parent changed event for the control
and
| subscribe to the Parent's visibility changed event. Seems to work well
| enough for me and then all of my derived controls will automatically work
| with no extra work on any tab control or anything else I might put them
in.
|
| Lance Johnson
|
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:ui**************@cpmsftngxa06.phx.gbl...
| >
| > Hi Lance,
| >
| > I think you should inherit a new class from your control and custom some
| > methods
| > to your control(such as release lock).
| > Then, in the SelectedIndexChanged event, you can record the last
invisable
| > tab index
| > and invoke all the related method of the controls in that tab page.
| > If I still misunderstand you, please do not be hesitated to tell me.
| >
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | From: "Lance Johnson" <lj******@docs.com>
| > | References: <uJ*************@TK2MSFTNGP09.phx.gbl>
| > <#7*************@TK2MSFTNGP10.phx.gbl>
| > <ux*************@TK2MSFTNGP10.phx.gbl>
<bi**********@titan.btinternet.com>
| > | Subject: Re: tab control and tab changed
| > | Date: Tue, 26 Aug 2003 16:09:42 -0500
| > | Lines: 31
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#h**************@TK2MSFTNGP09.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: 204.95.153.41
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:180048
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | I could do that, however what could I call that would allow the
control
| to
| > | know it's not visible any more. If I set control.visible to false
that
| > does
| > | nothing, because it's already set to false. That's my #1 problem is
| that
| > | it's visibility gets set to false without the event occurring.
| > |
| > | Lance Johnson
| > |
| > | "Paul E Collins" <fi******************@CL4.org> wrote in message
| > | news:bi**********@titan.btinternet.com...
| > | > "Lance Johnson" <lj******@docs.com> wrote:
| > | >
| > | > > > Use TabControl.SelectedIndexChanged event.
| > | > >
| > | > > I'm well aware of that event, however that does me
| > | > > no good for notifying my client controls for the
| > | > > previous tab. I'd rather not use the workaround of
| > | > > remembering the last tab page manually.
| > | >
| > | > When SelectedIndexChanged occurs, you could use a foreach statement
to
| > | > iterate over the TabPages in your TabControl and disable the
controls
| on
| > | any
| > | > TabPage that isn't the currently selected one.
| > | >
| > | > P.
| > | >
| > | > --
| > | > www.CL4.org
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #8

P: n/a
That's very strange. You're saying that when a tab page gets change there's
no event happening on the tab page itself. Because I'm hooking into that
event and when I click on another tab it's firing for me and I'm able to
update my stuff correctly.

Lance Johnson
"Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
news:TO**************@cpmsftngxa06.phx.gbl...

Hi Lance,

I can reproduce your problem.
When clicking the tab page, the unvisabled control does not fire
VisibleChanged
event.
I have used Spy++ to watch the control's message when its parent tab page
get
unvisabled, finding that no message generated.

I also found that the control's VisibleChanged event fires go with the
WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED message.
I think the windows implement the control's visable change by changing their z-order, when the control on the tab page was unvisabled, its absolute
z-order did
not change, but the visable tab page's z-order get up and lay over the
control, so
the VisibleChanged event did not fire.
While click the tab page that contains the control, the control's absolute
z-order needs
get up and VisibleChanged fired.

So you can not use this way of doing what you want, please try some way
that we suggested.
It will work around your problem.

Hope this helps.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Lance Johnson" <lj******@docs.com>
| References: <uJ*************@TK2MSFTNGP09.phx.gbl>
<#7*************@TK2MSFTNGP10.phx.gbl>
<ux*************@TK2MSFTNGP10.phx.gbl> <bi**********@titan.btinternet.com>
<#h**************@TK2MSFTNGP09.phx.gbl>
<ui**************@cpmsftngxa06.phx.gbl>
| Subject: Re: tab control and tab changed
| Date: Mon, 8 Sep 2003 11:24:27 -0500
| Lines: 87
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <OT**************@tk2msftngp13.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 204.95.153.41
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:183222 | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I was just hoping there was a easier way of automatically doing this.
What
| I've done instead is to look at the parent changed event for the control
and
| subscribe to the Parent's visibility changed event. Seems to work well
| enough for me and then all of my derived controls will automatically work | with no extra work on any tab control or anything else I might put them
in.
|
| Lance Johnson
|
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:ui**************@cpmsftngxa06.phx.gbl...
| >
| > Hi Lance,
| >
| > I think you should inherit a new class from your control and custom some | > methods
| > to your control(such as release lock).
| > Then, in the SelectedIndexChanged event, you can record the last
invisable
| > tab index
| > and invoke all the related method of the controls in that tab page.
| > If I still misunderstand you, please do not be hesitated to tell me.
| >
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | From: "Lance Johnson" <lj******@docs.com>
| > | References: <uJ*************@TK2MSFTNGP09.phx.gbl>
| > <#7*************@TK2MSFTNGP10.phx.gbl>
| > <ux*************@TK2MSFTNGP10.phx.gbl>
<bi**********@titan.btinternet.com>
| > | Subject: Re: tab control and tab changed
| > | Date: Tue, 26 Aug 2003 16:09:42 -0500
| > | Lines: 31
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <#h**************@TK2MSFTNGP09.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: 204.95.153.41
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:180048
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | I could do that, however what could I call that would allow the
control
| to
| > | know it's not visible any more. If I set control.visible to false
that
| > does
| > | nothing, because it's already set to false. That's my #1 problem is
| that
| > | it's visibility gets set to false without the event occurring.
| > |
| > | Lance Johnson
| > |
| > | "Paul E Collins" <fi******************@CL4.org> wrote in message
| > | news:bi**********@titan.btinternet.com...
| > | > "Lance Johnson" <lj******@docs.com> wrote:
| > | >
| > | > > > Use TabControl.SelectedIndexChanged event.
| > | > >
| > | > > I'm well aware of that event, however that does me
| > | > > no good for notifying my client controls for the
| > | > > previous tab. I'd rather not use the workaround of
| > | > > remembering the last tab page manually.
| > | >
| > | > When SelectedIndexChanged occurs, you could use a foreach statement to
| > | > iterate over the TabPages in your TabControl and disable the
controls
| on
| > | any
| > | > TabPage that isn't the currently selected one.
| > | >
| > | > P.
| > | >
| > | > --
| > | > www.CL4.org
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #9

P: n/a

Hi Lance,

I think I did not express clear.
When click another tab page, the tab control will fire its event, but
the button control in the tab page does not fire the its VisibleChanged
Also, the button did not generate any message.
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| From: "Lance Johnson" <lj******@docs.com>
| References: <uJ*************@TK2MSFTNGP09.phx.gbl>
<#7*************@TK2MSFTNGP10.phx.gbl>
<ux*************@TK2MSFTNGP10.phx.gbl> <bi**********@titan.btinternet.com>
<#h**************@TK2MSFTNGP09.phx.gbl>
<ui**************@cpmsftngxa06.phx.gbl>
<OT**************@tk2msftngp13.phx.gbl>
<TO**************@cpmsftngxa06.phx.gbl>
| Subject: Re: tab control and tab changed
| Date: Fri, 12 Sep 2003 16:26:22 -0500
| Lines: 171
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <Oa**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.languages.csharp
| NNTP-Posting-Host: 204.95.153.41
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:184535
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| That's very strange. You're saying that when a tab page gets change
there's
| no event happening on the tab page itself. Because I'm hooking into that
| event and when I click on another tab it's firing for me and I'm able to
| update my stuff correctly.
|
| Lance Johnson
|
|
| "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| news:TO**************@cpmsftngxa06.phx.gbl...
| >
| > Hi Lance,
| >
| > I can reproduce your problem.
| > When clicking the tab page, the unvisabled control does not fire
| > VisibleChanged
| > event.
| > I have used Spy++ to watch the control's message when its parent tab
page
| > get
| > unvisabled, finding that no message generated.
| >
| > I also found that the control's VisibleChanged event fires go with the
| > WM_WINDOWPOSCHANGING and WM_WINDOWPOSCHANGED message.
| > I think the windows implement the control's visable change by changing
| their
| > z-order, when the control on the tab page was unvisabled, its absolute
| > z-order did
| > not change, but the visable tab page's z-order get up and lay over the
| > control, so
| > the VisibleChanged event did not fire.
| > While click the tab page that contains the control, the control's
absolute
| > z-order needs
| > get up and VisibleChanged fired.
| >
| > So you can not use this way of doing what you want, please try some way
| > that we suggested.
| > It will work around your problem.
| >
| > Hope this helps.
| > Best regards,
| > Jeffrey Tan
| > Microsoft Online Partner Support
| > Get Secure! - www.microsoft.com/security
| > This posting is provided "as is" with no warranties and confers no
rights.
| >
| > --------------------
| > | From: "Lance Johnson" <lj******@docs.com>
| > | References: <uJ*************@TK2MSFTNGP09.phx.gbl>
| > <#7*************@TK2MSFTNGP10.phx.gbl>
| > <ux*************@TK2MSFTNGP10.phx.gbl>
<bi**********@titan.btinternet.com>
| > <#h**************@TK2MSFTNGP09.phx.gbl>
| > <ui**************@cpmsftngxa06.phx.gbl>
| > | Subject: Re: tab control and tab changed
| > | Date: Mon, 8 Sep 2003 11:24:27 -0500
| > | Lines: 87
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <OT**************@tk2msftngp13.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | NNTP-Posting-Host: 204.95.153.41
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.languages.csharp:183222
| > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > |
| > | I was just hoping there was a easier way of automatically doing this.
| > What
| > | I've done instead is to look at the parent changed event for the
control
| > and
| > | subscribe to the Parent's visibility changed event. Seems to work
well
| > | enough for me and then all of my derived controls will automatically
| work
| > | with no extra work on any tab control or anything else I might put
them
| > in.
| > |
| > | Lance Johnson
| > |
| > |
| > | "Jeffrey Tan[MSFT]" <v-*****@online.microsoft.com> wrote in message
| > | news:ui**************@cpmsftngxa06.phx.gbl...
| > | >
| > | > Hi Lance,
| > | >
| > | > I think you should inherit a new class from your control and custom
| some
| > | > methods
| > | > to your control(such as release lock).
| > | > Then, in the SelectedIndexChanged event, you can record the last
| > invisable
| > | > tab index
| > | > and invoke all the related method of the controls in that tab page.
| > | > If I still misunderstand you, please do not be hesitated to tell me.
| > | >
| > | > Best regards,
| > | > Jeffrey Tan
| > | > Microsoft Online Partner Support
| > | > Get Secure! - www.microsoft.com/security
| > | > This posting is provided "as is" with no warranties and confers no
| > rights.
| > | >
| > | > --------------------
| > | > | From: "Lance Johnson" <lj******@docs.com>
| > | > | References: <uJ*************@TK2MSFTNGP09.phx.gbl>
| > | > <#7*************@TK2MSFTNGP10.phx.gbl>
| > | > <ux*************@TK2MSFTNGP10.phx.gbl>
| > <bi**********@titan.btinternet.com>
| > | > | Subject: Re: tab control and tab changed
| > | > | Date: Tue, 26 Aug 2003 16:09:42 -0500
| > | > | Lines: 31
| > | > | X-Priority: 3
| > | > | X-MSMail-Priority: Normal
| > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | > | Message-ID: <#h**************@TK2MSFTNGP09.phx.gbl>
| > | > | Newsgroups: microsoft.public.dotnet.languages.csharp
| > | > | NNTP-Posting-Host: 204.95.153.41
| > | > | Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
| > | > | Xref: cpmsftngxa06.phx.gbl
| > | microsoft.public.dotnet.languages.csharp:180048
| > | > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
| > | > |
| > | > | I could do that, however what could I call that would allow the
| > control
| > | to
| > | > | know it's not visible any more. If I set control.visible to false
| > that
| > | > does
| > | > | nothing, because it's already set to false. That's my #1 problem
is
| > | that
| > | > | it's visibility gets set to false without the event occurring.
| > | > |
| > | > | Lance Johnson
| > | > |
| > | > | "Paul E Collins" <fi******************@CL4.org> wrote in message
| > | > | news:bi**********@titan.btinternet.com...
| > | > | > "Lance Johnson" <lj******@docs.com> wrote:
| > | > | >
| > | > | > > > Use TabControl.SelectedIndexChanged event.
| > | > | > >
| > | > | > > I'm well aware of that event, however that does me
| > | > | > > no good for notifying my client controls for the
| > | > | > > previous tab. I'd rather not use the workaround of
| > | > | > > remembering the last tab page manually.
| > | > | >
| > | > | > When SelectedIndexChanged occurs, you could use a foreach
| statement
| > to
| > | > | > iterate over the TabPages in your TabControl and disable the
| > controls
| > | on
| > | > | any
| > | > | > TabPage that isn't the currently selected one.
| > | > | >
| > | > | > P.
| > | > | >
| > | > | > --
| > | > | > www.CL4.org
| > | > | >
| > | > | >
| > | > |
| > | > |
| > | > |
| > | >
| > |
| > |
| > |
| >
|
|
|

Nov 15 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.