473,467 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

tab control and tab changed

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
9 7955
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
"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

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
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

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
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

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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joe Loyd | last post by:
I have a Web form made up of several panels of controls. On postback, I need to detect if any of the controls were updated. Is there something like a "Panel.Changed" event or am I stuck iterating...
0
by: Steven | last post by:
Hi, I'm creating a custom checkbox list control which will take 2 arraylists as input. (One will contain Names and other will contain 0s and 1s. 0 - uncheck 1- check). I'm able to create the...
6
by: Tom Rowton | last post by:
This one has me a bit confused and I'm not finding what I need in the MSDN or by searching these forums, so here goes... I have a rather large, complex code-in-page WebForm (don't ask) and a...
2
by: Tascien | last post by:
Guys, I am trying to run through the page controls, if the controls' id is found in the database, then I change the corresponding text from the database. but, the system is coming back with...
2
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
4
by: Neil Stevens | last post by:
Hi, Merry Christmas to you all. I have a problem with server controls, i am writing a C# ASP.NET web project and i am creating custom server controls for some of the more common element. One...
4
by: louise raisbeck | last post by:
Hi I know there are many posts on this but cant seem to find simple answer. I have lots of text boxes in a datalist edittemplate control. i dont want to do an update statement for all of them, as...
3
by: epigram | last post by:
I've tried asking this question several times and have received many good answers, but ones that don't quite answer my question. This leads me to believe that I am trying to do something very...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.