tab control and tab changed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lance Johnson

    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


  • Val Savvateev

    #2
    Re: tab control and tab changed

    Use TabControl.Sele ctedIndexChange d event.

    "Lance Johnson" <ljohnson@docs. com> wrote in message
    news:uJLb51AbDH A.880@TK2MSFTNG P09.phx.gbl...[color=blue]
    > 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
    >
    >[/color]


    Comment

    • Paul E Collins

      #3
      Re: tab control and tab changed

      "Lance Johnson" <ljohnson@docs. com> wrote:
      [color=blue][color=green]
      > > Use TabControl.Sele ctedIndexChange d event.[/color]
      >
      > 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.[/color]

      When SelectedIndexCh anged 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.

      --



      Comment

      • Jeffrey Tan[MSFT]

        #4
        Re: tab control and tab changed


        Hi Lance,

        In SelectedIndexCh anged 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.Tab Pages[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" <ljohnson@docs. com>
        | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
        <#7ZQE4AbDHA.38 8@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: <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl>
        | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
        | NNTP-Posting-Host: 204.95.153.41
        | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
        | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1796 32
        | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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" <vsavvateev@mer idium.com_NO_SP AM> wrote in message
        | news:%237ZQE4Ab DHA.388@TK2MSFT NGP10.phx.gbl.. .
        | > Use TabControl.Sele ctedIndexChange d event.
        | >
        | > "Lance Johnson" <ljohnson@docs. com> wrote in message
        | > news:uJLb51AbDH A.880@TK2MSFTNG P09.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
        | > >
        | > >
        | >
        | >
        |
        |
        |

        Comment

        • Lance Johnson

          #5
          Re: tab control and tab changed

          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" <find_my_real_a ddress@CL4.org> wrote in message
          news:bigh74$171 $1@titan.btinte rnet.com...[color=blue]
          > "Lance Johnson" <ljohnson@docs. com> wrote:
          >[color=green][color=darkred]
          > > > Use TabControl.Sele ctedIndexChange d event.[/color]
          > >
          > > 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.[/color]
          >
          > When SelectedIndexCh anged occurs, you could use a foreach statement to
          > iterate over the TabPages in your TabControl and disable the controls on[/color]
          any[color=blue]
          > TabPage that isn't the currently selected one.
          >
          > P.
          >
          > --
          > www.CL4.org
          >
          >[/color]


          Comment

          • Jeffrey Tan[MSFT]

            #6
            Re: tab control and tab changed


            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 SelectedIndexCh anged 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" <ljohnson@docs. com>
            | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
            <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
            <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl> <bigh74$171$1@t itan.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: <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
            | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
            | NNTP-Posting-Host: 204.95.153.41
            | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
            | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1800 48
            | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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" <find_my_real_a ddress@CL4.org> wrote in message
            | news:bigh74$171 $1@titan.btinte rnet.com...
            | > "Lance Johnson" <ljohnson@docs. com> wrote:
            | >
            | > > > Use TabControl.Sele ctedIndexChange d 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 SelectedIndexCh anged 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
            | >
            | >
            |
            |
            |

            Comment

            • Lance Johnson

              #7
              Re: tab control and tab changed

              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-jetan@online.mi crosoft.com> wrote in message
              news:uiw1spbdDH A.1120@cpmsftng xa06.phx.gbl...[color=blue]
              >
              > 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 SelectedIndexCh anged 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" <ljohnson@docs. com>
              > | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
              > <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
              > <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl> <bigh74$171$1@t itan.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: <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
              > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
              > | NNTP-Posting-Host: 204.95.153.41
              > | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
              > | Xref: cpmsftngxa06.ph x.gbl[/color]
              microsoft.publi c.dotnet.langua ges.csharp:1800 48[color=blue]
              > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.csharp
              > |
              > | I could do that, however what could I call that would allow the control[/color]
              to[color=blue]
              > | 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[/color]
              that[color=blue]
              > | it's visibility gets set to false without the event occurring.
              > |
              > | Lance Johnson
              > |
              > | "Paul E Collins" <find_my_real_a ddress@CL4.org> wrote in message
              > | news:bigh74$171 $1@titan.btinte rnet.com...
              > | > "Lance Johnson" <ljohnson@docs. com> wrote:
              > | >
              > | > > > Use TabControl.Sele ctedIndexChange d 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 SelectedIndexCh anged occurs, you could use a foreach statement to
              > | > iterate over the TabPages in your TabControl and disable the controls[/color]
              on[color=blue]
              > | any
              > | > TabPage that isn't the currently selected one.
              > | >
              > | > P.
              > | >
              > | > --
              > | > www.CL4.org
              > | >
              > | >
              > |
              > |
              > |
              >[/color]


              Comment

              • Jeffrey Tan[MSFT]

                #8
                Re: tab control and tab changed


                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_WINDOWPOSCHA NGING and WM_WINDOWPOSCHA NGED 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" <ljohnson@docs. com>
                | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
                <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl> <bigh74$171$1@t itan.btinternet .com>
                <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
                <uiw1spbdDHA.11 20@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: <OTB#uWidDHA.40 20@tk2msftngp13 .phx.gbl>
                | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                | NNTP-Posting-Host: 204.95.153.41
                | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
                | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1832 22
                | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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-jetan@online.mi crosoft.com> wrote in message
                | news:uiw1spbdDH A.1120@cpmsftng xa06.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 SelectedIndexCh anged 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" <ljohnson@docs. com>
                | > | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
                | > <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                | > <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                <bigh74$171$1@t itan.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: <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
                | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                | > | NNTP-Posting-Host: 204.95.153.41
                | > | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
                | > | Xref: cpmsftngxa06.ph x.gbl
                | microsoft.publi c.dotnet.langua ges.csharp:1800 48
                | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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" <find_my_real_a ddress@CL4.org> wrote in message
                | > | news:bigh74$171 $1@titan.btinte rnet.com...
                | > | > "Lance Johnson" <ljohnson@docs. com> wrote:
                | > | >
                | > | > > > Use TabControl.Sele ctedIndexChange d 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 SelectedIndexCh anged 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
                | > | >
                | > | >
                | > |
                | > |
                | > |
                | >
                |
                |
                |

                Comment

                • Lance Johnson

                  #9
                  Re: tab control and tab changed

                  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-jetan@online.mi crosoft.com> wrote in message
                  news:TOm5dbrdDH A.2116@cpmsftng xa06.phx.gbl...[color=blue]
                  >
                  > 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_WINDOWPOSCHA NGING and WM_WINDOWPOSCHA NGED message.
                  > I think the windows implement the control's visable change by changing[/color]
                  their[color=blue]
                  > 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" <ljohnson@docs. com>
                  > | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
                  > <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                  > <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl> <bigh74$171$1@t itan.btinternet .com>
                  > <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
                  > <uiw1spbdDHA.11 20@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: <OTB#uWidDHA.40 20@tk2msftngp13 .phx.gbl>
                  > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                  > | NNTP-Posting-Host: 204.95.153.41
                  > | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
                  > | Xref: cpmsftngxa06.ph x.gbl[/color]
                  microsoft.publi c.dotnet.langua ges.csharp:1832 22[color=blue]
                  > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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[/color]
                  work[color=blue]
                  > | with no extra work on any tab control or anything else I might put them
                  > in.
                  > |
                  > | Lance Johnson
                  > |
                  > |
                  > | "Jeffrey Tan[MSFT]" <v-jetan@online.mi crosoft.com> wrote in message
                  > | news:uiw1spbdDH A.1120@cpmsftng xa06.phx.gbl...
                  > | >
                  > | > Hi Lance,
                  > | >
                  > | > I think you should inherit a new class from your control and custom[/color]
                  some[color=blue]
                  > | > methods
                  > | > to your control(such as release lock).
                  > | > Then, in the SelectedIndexCh anged 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" <ljohnson@docs. com>
                  > | > | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
                  > | > <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                  > | > <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                  > <bigh74$171$1@t itan.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: <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
                  > | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                  > | > | NNTP-Posting-Host: 204.95.153.41
                  > | > | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
                  > | > | Xref: cpmsftngxa06.ph x.gbl
                  > | microsoft.publi c.dotnet.langua ges.csharp:1800 48
                  > | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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" <find_my_real_a ddress@CL4.org> wrote in message
                  > | > | news:bigh74$171 $1@titan.btinte rnet.com...
                  > | > | > "Lance Johnson" <ljohnson@docs. com> wrote:
                  > | > | >
                  > | > | > > > Use TabControl.Sele ctedIndexChange d 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 SelectedIndexCh anged occurs, you could use a foreach[/color]
                  statement[color=blue]
                  > 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
                  > | > | >
                  > | > | >
                  > | > |
                  > | > |
                  > | > |
                  > | >
                  > |
                  > |
                  > |
                  >[/color]


                  Comment

                  • Jeffrey Tan[MSFT]

                    #10
                    Re: tab control and tab changed


                    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" <ljohnson@docs. com>
                    | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
                    <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                    <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl> <bigh74$171$1@t itan.btinternet .com>
                    <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
                    <uiw1spbdDHA.11 20@cpmsftngxa06 .phx.gbl>
                    <OTB#uWidDHA.40 20@tk2msftngp13 .phx.gbl>
                    <TOm5dbrdDHA.21 16@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: <OaM9ESXeDHA.17 00@TK2MSFTNGP10 .phx.gbl>
                    | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                    | NNTP-Posting-Host: 204.95.153.41
                    | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
                    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1845 35
                    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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-jetan@online.mi crosoft.com> wrote in message
                    | news:TOm5dbrdDH A.2116@cpmsftng xa06.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_WINDOWPOSCHA NGING and WM_WINDOWPOSCHA NGED 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" <ljohnson@docs. com>
                    | > | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
                    | > <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                    | > <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                    <bigh74$171$1@t itan.btinternet .com>
                    | > <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
                    | > <uiw1spbdDHA.11 20@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: <OTB#uWidDHA.40 20@tk2msftngp13 .phx.gbl>
                    | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                    | > | NNTP-Posting-Host: 204.95.153.41
                    | > | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
                    | > | Xref: cpmsftngxa06.ph x.gbl
                    | microsoft.publi c.dotnet.langua ges.csharp:1832 22
                    | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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-jetan@online.mi crosoft.com> wrote in message
                    | > | news:uiw1spbdDH A.1120@cpmsftng xa06.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 SelectedIndexCh anged 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" <ljohnson@docs. com>
                    | > | > | References: <uJLb51AbDHA.88 0@TK2MSFTNGP09. phx.gbl>
                    | > | > <#7ZQE4AbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                    | > | > <ux6ztABbDHA.38 8@TK2MSFTNGP10. phx.gbl>
                    | > <bigh74$171$1@t itan.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: <#hS7egObDHA.23 28@TK2MSFTNGP09 .phx.gbl>
                    | > | > | Newsgroups: microsoft.publi c.dotnet.langua ges.csharp
                    | > | > | NNTP-Posting-Host: 204.95.153.41
                    | > | > | Path:
                    cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
                    | > | > | Xref: cpmsftngxa06.ph x.gbl
                    | > | microsoft.publi c.dotnet.langua ges.csharp:1800 48
                    | > | > | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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" <find_my_real_a ddress@CL4.org> wrote in message
                    | > | > | news:bigh74$171 $1@titan.btinte rnet.com...
                    | > | > | > "Lance Johnson" <ljohnson@docs. com> wrote:
                    | > | > | >
                    | > | > | > > > Use TabControl.Sele ctedIndexChange d 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 SelectedIndexCh anged 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
                    | > | > | >
                    | > | > | >
                    | > | > |
                    | > | > |
                    | > | > |
                    | > | >
                    | > |
                    | > |
                    | > |
                    | >
                    |
                    |
                    |

                    Comment

                    Working...