Bug with TreeView control

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

    Bug with TreeView control

    The below problem occurs randomly too, but I've managed to isolate a
    sequence of events when it always happens:

    I have two forms (say Form1 and Form2). Form 1 contains a TreeView control.
    A button from Form1 opens Form2 and a button in Form2 sends the user back to
    Form1.

    When the user goes back to Form1 from Form2, the TreeView control rebuilds
    the nodes incredibly slowly. You can see the progress, as the scroll bar
    slowly starts sliding down. It normally takes around 30 seconds to rebuild
    the tree. When the tree is finished, every node is fully expanded. Also,
    when I go into edit mode, the TreeView control displays all the data, rather
    than the more usual "Sample Node" mini-tree.

    Can anyone help? The TreeView control is essential to my application, and I
    can't expect users to wait 30 seconds each time they switch between forms
    while the TreeView does its very weird stuff.

    Thanks
    Jim


  • Mike Storr

    #2
    Re: Bug with TreeView control

    On Mon, 23 Feb 2004 23:05:35 -0000, Jim wrote:
    [color=blue]
    > The below problem occurs randomly too, but I've managed to isolate a
    > sequence of events when it always happens:
    >
    > I have two forms (say Form1 and Form2). Form 1 contains a TreeView control.
    > A button from Form1 opens Form2 and a button in Form2 sends the user back to
    > Form1.
    >
    > When the user goes back to Form1 from Form2, the TreeView control rebuilds
    > the nodes incredibly slowly. You can see the progress, as the scroll bar
    > slowly starts sliding down. It normally takes around 30 seconds to rebuild
    > the tree. When the tree is finished, every node is fully expanded. Also,
    > when I go into edit mode, the TreeView control displays all the data, rather
    > than the more usual "Sample Node" mini-tree.
    >
    > Can anyone help? The TreeView control is essential to my application, and I
    > can't expect users to wait 30 seconds each time they switch between forms
    > while the TreeView does its very weird stuff.
    >
    > Thanks
    > Jim[/color]

    Is it possible to move the rebuilding of the tree to an event that dosen't
    run as frequently? I get the feeling you are doing it OnActivate or the
    like.
    --
    Mike Storr

    Comment

    • Alex Dybenko

      #3
      Re: Bug with TreeView control


      hmm, not clear why TV starts to rebuild. do you have some code for this run
      when you switch to form? normally it just stays as it is when form
      activated/deactiuvated

      --
      Alex Dybenko (MVP)



      "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
      news:4Gv_b.1312 $ta.723@newsfe1-win...[color=blue]
      > The below problem occurs randomly too, but I've managed to isolate a
      > sequence of events when it always happens:
      >
      > I have two forms (say Form1 and Form2). Form 1 contains a TreeView[/color]
      control.[color=blue]
      > A button from Form1 opens Form2 and a button in Form2 sends the user back[/color]
      to[color=blue]
      > Form1.
      >
      > When the user goes back to Form1 from Form2, the TreeView control rebuilds
      > the nodes incredibly slowly. You can see the progress, as the scroll bar
      > slowly starts sliding down. It normally takes around 30 seconds to rebuild
      > the tree. When the tree is finished, every node is fully expanded. Also,
      > when I go into edit mode, the TreeView control displays all the data,[/color]
      rather[color=blue]
      > than the more usual "Sample Node" mini-tree.
      >
      > Can anyone help? The TreeView control is essential to my application, and[/color]
      I[color=blue]
      > can't expect users to wait 30 seconds each time they switch between forms
      > while the TreeView does its very weird stuff.
      >
      > Thanks
      > Jim
      >
      >[/color]


      Comment

      • Jim

        #4
        Re: Bug with TreeView control

        That's why it's so bizarre. I only build the tree once, yet when I switch
        between forms, it rebuilds itself extremely slowly. if i get a chance, i'll
        try and replicate it and give you a url to a db so you can see for yourself.

        By the way, the problem fixes itself if i remove and readd the tree .... but
        only temporarily.

        Thanks
        Jim


        "Alex Dybenko" <alex@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message
        news:eHYpF5p%23 DHA.3500@TK2MSF TNGP10.phx.gbl. ..[color=blue]
        >
        > hmm, not clear why TV starts to rebuild. do you have some code for this[/color]
        run[color=blue]
        > when you switch to form? normally it just stays as it is when form
        > activated/deactiuvated
        >
        > --
        > Alex Dybenko (MVP)
        > http://Alex.Dybenko.com
        >
        >
        > "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
        > news:4Gv_b.1312 $ta.723@newsfe1-win...[color=green]
        > > The below problem occurs randomly too, but I've managed to isolate a
        > > sequence of events when it always happens:
        > >
        > > I have two forms (say Form1 and Form2). Form 1 contains a TreeView[/color]
        > control.[color=green]
        > > A button from Form1 opens Form2 and a button in Form2 sends the user[/color][/color]
        back[color=blue]
        > to[color=green]
        > > Form1.
        > >
        > > When the user goes back to Form1 from Form2, the TreeView control[/color][/color]
        rebuilds[color=blue][color=green]
        > > the nodes incredibly slowly. You can see the progress, as the scroll bar
        > > slowly starts sliding down. It normally takes around 30 seconds to[/color][/color]
        rebuild[color=blue][color=green]
        > > the tree. When the tree is finished, every node is fully expanded. Also,
        > > when I go into edit mode, the TreeView control displays all the data,[/color]
        > rather[color=green]
        > > than the more usual "Sample Node" mini-tree.
        > >
        > > Can anyone help? The TreeView control is essential to my application,[/color][/color]
        and[color=blue]
        > I[color=green]
        > > can't expect users to wait 30 seconds each time they switch between[/color][/color]
        forms[color=blue][color=green]
        > > while the TreeView does its very weird stuff.
        > >
        > > Thanks
        > > Jim
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Bradley

          #5
          Re: Bug with TreeView control

          Try turning off the option "Track name AutoCorrect info"?

          This causes a slowdown of complex forms once the design is changed.
          --
          Bradley
          Software Developer www.hrsystems.com.au
          A Christian Response www.pastornet.net.au/response

          "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
          news:42a%b.2071 0$ft.20607@news fe1-win...[color=blue]
          > That's why it's so bizarre. I only build the tree once, yet when I switch
          > between forms, it rebuilds itself extremely slowly. if i get a chance,[/color]
          i'll[color=blue]
          > try and replicate it and give you a url to a db so you can see for[/color]
          yourself.[color=blue]
          >
          > By the way, the problem fixes itself if i remove and readd the tree ....[/color]
          but[color=blue]
          > only temporarily.
          >
          > Thanks
          > Jim
          >
          >
          > "Alex Dybenko" <alex@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message
          > news:eHYpF5p%23 DHA.3500@TK2MSF TNGP10.phx.gbl. ..[color=green]
          > >
          > > hmm, not clear why TV starts to rebuild. do you have some code for this[/color]
          > run[color=green]
          > > when you switch to form? normally it just stays as it is when form
          > > activated/deactiuvated
          > >
          > > --
          > > Alex Dybenko (MVP)
          > > http://Alex.Dybenko.com
          > >
          > >
          > > "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
          > > news:4Gv_b.1312 $ta.723@newsfe1-win...[color=darkred]
          > > > The below problem occurs randomly too, but I've managed to isolate a
          > > > sequence of events when it always happens:
          > > >
          > > > I have two forms (say Form1 and Form2). Form 1 contains a TreeView[/color]
          > > control.[color=darkred]
          > > > A button from Form1 opens Form2 and a button in Form2 sends the user[/color][/color]
          > back[color=green]
          > > to[color=darkred]
          > > > Form1.
          > > >
          > > > When the user goes back to Form1 from Form2, the TreeView control[/color][/color]
          > rebuilds[color=green][color=darkred]
          > > > the nodes incredibly slowly. You can see the progress, as the scroll[/color][/color][/color]
          bar[color=blue][color=green][color=darkred]
          > > > slowly starts sliding down. It normally takes around 30 seconds to[/color][/color]
          > rebuild[color=green][color=darkred]
          > > > the tree. When the tree is finished, every node is fully expanded.[/color][/color][/color]
          Also,[color=blue][color=green][color=darkred]
          > > > when I go into edit mode, the TreeView control displays all the data,[/color]
          > > rather[color=darkred]
          > > > than the more usual "Sample Node" mini-tree.
          > > >
          > > > Can anyone help? The TreeView control is essential to my application,[/color][/color]
          > and[color=green]
          > > I[color=darkred]
          > > > can't expect users to wait 30 seconds each time they switch between[/color][/color]
          > forms[color=green][color=darkred]
          > > > while the TreeView does its very weird stuff.
          > > >
          > > > Thanks
          > > > Jim
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Jim

            #6
            Re: Bug with TreeView control

            Bradley

            Thanks for your reply. It sounded like a great idea, and something I
            would never have thought of. Unfortunately though, it didn't work.

            I've now isolated the offending line, which is:

            xTree.Object.No des.Clear

            in the Form_Open sub (xTree being the instance of the Tree Control)

            Can anyone tell me if I'm doing something blatently wrong? As I
            mentioned in a previous post, I don't get this problem on other PCs,
            yet the offending line, if removed, removes the problem on my PC.

            Thanks
            Jim

            "Bradley" <bradley@REMOVE THIScomcen.com. au> wrote in message news:<k4b%b.764 92$Wa.8282@news-server.bigpond. net.au>...[color=blue]
            > Try turning off the option "Track name AutoCorrect info"?
            >
            > This causes a slowdown of complex forms once the design is changed.
            > --
            > Bradley
            > Software Developer www.hrsystems.com.au
            > A Christian Response www.pastornet.net.au/response
            >
            > "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
            > news:42a%b.2071 0$ft.20607@news fe1-win...[color=green]
            > > That's why it's so bizarre. I only build the tree once, yet when I switch
            > > between forms, it rebuilds itself extremely slowly. if i get a chance,[/color]
            > i'll[color=green]
            > > try and replicate it and give you a url to a db so you can see for[/color]
            > yourself.[color=green]
            > >
            > > By the way, the problem fixes itself if i remove and readd the tree ....[/color]
            > but[color=green]
            > > only temporarily.
            > >
            > > Thanks
            > > Jim[/color][/color]

            Comment

            • Alex Dybenko

              #7
              Re: Bug with TreeView control

              Hi,
              1. do not use form Open event - use only Load event to work with activex
              controls
              2. during clear operation TV redraws a lot, so try to switch it off:

              SendMessage oTV.hWnd, WM_SETREDRAW, 0, ByVal 0&
              oTV.Nodes.Clear
              SendMessage oTV.hWnd, WM_SETREDRAW, 1, ByVal 0&

              in declration section:
              Public Declare Function SendMessage Lib "user32" Alias "SendMessag eA" _
              (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As _
              Any) As Long

              Public Const WM_SETREDRAW = &HB

              HTH
              --
              Alex Dybenko (MVP)





              "Jim" <jshentz@hotmai l.com> wrote in message
              news:5c59f085.0 403030206.29272 99@posting.goog le.com...[color=blue]
              > Bradley
              >
              > Thanks for your reply. It sounded like a great idea, and something I
              > would never have thought of. Unfortunately though, it didn't work.
              >
              > I've now isolated the offending line, which is:
              >
              > xTree.Object.No des.Clear
              >
              > in the Form_Open sub (xTree being the instance of the Tree Control)
              >
              > Can anyone tell me if I'm doing something blatently wrong? As I
              > mentioned in a previous post, I don't get this problem on other PCs,
              > yet the offending line, if removed, removes the problem on my PC.
              >
              > Thanks
              > Jim
              >
              > "Bradley" <bradley@REMOVE THIScomcen.com. au> wrote in message[/color]
              news:<k4b%b.764 92$Wa.8282@news-server.bigpond. net.au>...[color=blue][color=green]
              > > Try turning off the option "Track name AutoCorrect info"?
              > >
              > > This causes a slowdown of complex forms once the design is changed.
              > > --
              > > Bradley
              > > Software Developer www.hrsystems.com.au
              > > A Christian Response www.pastornet.net.au/response
              > >
              > > "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
              > > news:42a%b.2071 0$ft.20607@news fe1-win...[color=darkred]
              > > > That's why it's so bizarre. I only build the tree once, yet when I[/color][/color][/color]
              switch[color=blue][color=green][color=darkred]
              > > > between forms, it rebuilds itself extremely slowly. if i get a chance,[/color]
              > > i'll[color=darkred]
              > > > try and replicate it and give you a url to a db so you can see for[/color]
              > > yourself.[color=darkred]
              > > >
              > > > By the way, the problem fixes itself if i remove and readd the tree[/color][/color][/color]
              .....[color=blue][color=green]
              > > but[color=darkred]
              > > > only temporarily.
              > > >
              > > > Thanks
              > > > Jim[/color][/color][/color]


              Comment

              • Jim

                #8
                Re: Bug with TreeView control

                Alex, I can't thank you enough. This has worked perfectly!!!

                Jim

                "Alex Dybenko" <alex@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message news:<ue2x6bUAE HA.3308@TK2MSFT NGP10.phx.gbl>. ..[color=blue]
                > Hi,
                > 1. do not use form Open event - use only Load event to work with activex
                > controls
                > 2. during clear operation TV redraws a lot, so try to switch it off:
                >
                > SendMessage oTV.hWnd, WM_SETREDRAW, 0, ByVal 0&
                > oTV.Nodes.Clear
                > SendMessage oTV.hWnd, WM_SETREDRAW, 1, ByVal 0&
                >
                > in declration section:
                > Public Declare Function SendMessage Lib "user32" Alias "SendMessag eA" _
                > (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As _
                > Any) As Long
                >
                > Public Const WM_SETREDRAW = &HB
                >
                > HTH
                > --
                > Alex Dybenko (MVP)
                > http://Alex.Dybenko.com
                > http://www.PointLtd.com
                >
                >
                >
                > "Jim" <jshentz@hotmai l.com> wrote in message
                > news:5c59f085.0 403030206.29272 99@posting.goog le.com...[color=green]
                > > Bradley
                > >
                > > Thanks for your reply. It sounded like a great idea, and something I
                > > would never have thought of. Unfortunately though, it didn't work.
                > >
                > > I've now isolated the offending line, which is:
                > >
                > > xTree.Object.No des.Clear
                > >
                > > in the Form_Open sub (xTree being the instance of the Tree Control)
                > >
                > > Can anyone tell me if I'm doing something blatently wrong? As I
                > > mentioned in a previous post, I don't get this problem on other PCs,
                > > yet the offending line, if removed, removes the problem on my PC.
                > >
                > > Thanks
                > > Jim
                > >
                > > "Bradley" <bradley@REMOVE THIScomcen.com. au> wrote in message[/color]
                > news:<k4b%b.764 92$Wa.8282@news-server.bigpond. net.au>...[color=green][color=darkred]
                > > > Try turning off the option "Track name AutoCorrect info"?
                > > >
                > > > This causes a slowdown of complex forms once the design is changed.
                > > > --
                > > > Bradley
                > > > Software Developer www.hrsystems.com.au
                > > > A Christian Response www.pastornet.net.au/response
                > > >
                > > > "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
                > > > news:42a%b.2071 0$ft.20607@news fe1-win...
                > > > > That's why it's so bizarre. I only build the tree once, yet when I[/color][/color]
                > switch[color=green][color=darkred]
                > > > > between forms, it rebuilds itself extremely slowly. if i get a chance,[/color][/color]
                > i'll[color=green][color=darkred]
                > > > > try and replicate it and give you a url to a db so you can see for[/color][/color]
                > yourself.[color=green][color=darkred]
                > > > >
                > > > > By the way, the problem fixes itself if i remove and readd the tree[/color][/color]
                > ....
                > but[color=green][color=darkred]
                > > > > only temporarily.
                > > > >
                > > > > Thanks
                > > > > Jim[/color][/color][/color]

                Comment

                • haiden

                  #9
                  Re: Bug with TreeView control


                  Jim <jshentz@hotmai l.com> wrote in message
                  news:5c59f085.0 403050117.14516 a13@posting.goo gle.com...[color=blue]
                  > Alex, I can't thank you enough. This has worked perfectly!!!
                  >
                  > Jim
                  >
                  > "Alex Dybenko" <alex@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message[/color]
                  news:<ue2x6bUAE HA.3308@TK2MSFT NGP10.phx.gbl>. ..[color=blue][color=green]
                  > > Hi,
                  > > 1. do not use form Open event - use only Load event to work with activex
                  > > controls
                  > > 2. during clear operation TV redraws a lot, so try to switch it off:
                  > >
                  > > SendMessage oTV.hWnd, WM_SETREDRAW, 0, ByVal 0&
                  > > oTV.Nodes.Clear
                  > > SendMessage oTV.hWnd, WM_SETREDRAW, 1, ByVal 0&
                  > >
                  > > in declration section:
                  > > Public Declare Function SendMessage Lib "user32" Alias "SendMessag eA" _
                  > > (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As[/color][/color]
                  _[color=blue][color=green]
                  > > Any) As Long
                  > >
                  > > Public Const WM_SETREDRAW = &HB
                  > >
                  > > HTH
                  > > --
                  > > Alex Dybenko (MVP)
                  > > http://Alex.Dybenko.com
                  > > http://www.PointLtd.com
                  > >
                  > >
                  > >
                  > > "Jim" <jshentz@hotmai l.com> wrote in message
                  > > news:5c59f085.0 403030206.29272 99@posting.goog le.com...[color=darkred]
                  > > > Bradley
                  > > >
                  > > > Thanks for your reply. It sounded like a great idea, and something I
                  > > > would never have thought of. Unfortunately though, it didn't work.
                  > > >
                  > > > I've now isolated the offending line, which is:
                  > > >
                  > > > xTree.Object.No des.Clear
                  > > >
                  > > > in the Form_Open sub (xTree being the instance of the Tree Control)
                  > > >
                  > > > Can anyone tell me if I'm doing something blatently wrong? As I
                  > > > mentioned in a previous post, I don't get this problem on other PCs,
                  > > > yet the offending line, if removed, removes the problem on my PC.
                  > > >
                  > > > Thanks
                  > > > Jim
                  > > >
                  > > > "Bradley" <bradley@REMOVE THIScomcen.com. au> wrote in message[/color]
                  > > news:<k4b%b.764 92$Wa.8282@news-server.bigpond. net.au>...[color=darkred]
                  > > > > Try turning off the option "Track name AutoCorrect info"?
                  > > > >
                  > > > > This causes a slowdown of complex forms once the design is changed.
                  > > > > --
                  > > > > Bradley
                  > > > > Software Developer www.hrsystems.com.au
                  > > > > A Christian Response www.pastornet.net.au/response
                  > > > >
                  > > > > "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
                  > > > > news:42a%b.2071 0$ft.20607@news fe1-win...
                  > > > > > That's why it's so bizarre. I only build the tree once, yet when I[/color]
                  > > switch[color=darkred]
                  > > > > > between forms, it rebuilds itself extremely slowly. if i get a[/color][/color][/color]
                  chance,[color=blue][color=green]
                  > > i'll[color=darkred]
                  > > > > > try and replicate it and give you a url to a db so you can see for[/color]
                  > > yourself.[color=darkred]
                  > > > > >
                  > > > > > By the way, the problem fixes itself if i remove and readd the[/color][/color][/color]
                  tree[color=blue][color=green]
                  > > ....
                  > > but[color=darkred]
                  > > > > > only temporarily.
                  > > > > >
                  > > > > > Thanks
                  > > > > > Jim[/color][/color][/color]


                  Comment

                  • haiden

                    #10
                    Re: Bug with TreeView control


                    Jim <jshentz@hotmai l.com> wrote in message
                    news:5c59f085.0 403050117.14516 a13@posting.goo gle.com...[color=blue]
                    > Alex, I can't thank you enough. This has worked perfectly!!!
                    >
                    > Jim
                    >
                    > "Alex Dybenko" <alex@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message[/color]
                    news:<ue2x6bUAE HA.3308@TK2MSFT NGP10.phx.gbl>. ..[color=blue][color=green]
                    > > Hi,
                    > > 1. do not use form Open event - use only Load event to work with activex
                    > > controls
                    > > 2. during clear operation TV redraws a lot, so try to switch it off:
                    > >
                    > > SendMessage oTV.hWnd, WM_SETREDRAW, 0, ByVal 0&
                    > > oTV.Nodes.Clear
                    > > SendMessage oTV.hWnd, WM_SETREDRAW, 1, ByVal 0&
                    > >
                    > > in declration section:
                    > > Public Declare Function SendMessage Lib "user32" Alias "SendMessag eA" _
                    > > (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As[/color][/color]
                    _[color=blue][color=green]
                    > > Any) As Long
                    > >
                    > > Public Const WM_SETREDRAW = &HB
                    > >
                    > > HTH
                    > > --
                    > > Alex Dybenko (MVP)
                    > > http://Alex.Dybenko.com
                    > > http://www.PointLtd.com
                    > >
                    > >
                    > >
                    > > "Jim" <jshentz@hotmai l.com> wrote in message
                    > > news:5c59f085.0 403030206.29272 99@posting.goog le.com...[color=darkred]
                    > > > Bradley
                    > > >
                    > > > Thanks for your reply. It sounded like a great idea, and something I
                    > > > would never have thought of. Unfortunately though, it didn't work.
                    > > >
                    > > > I've now isolated the offending line, which is:
                    > > >
                    > > > xTree.Object.No des.Clear
                    > > >
                    > > > in the Form_Open sub (xTree being the instance of the Tree Control)
                    > > >
                    > > > Can anyone tell me if I'm doing something blatently wrong? As I
                    > > > mentioned in a previous post, I don't get this problem on other PCs,
                    > > > yet the offending line, if removed, removes the problem on my PC.
                    > > >
                    > > > Thanks
                    > > > Jim
                    > > >
                    > > > "Bradley" <bradley@REMOVE THIScomcen.com. au> wrote in message[/color]
                    > > news:<k4b%b.764 92$Wa.8282@news-server.bigpond. net.au>...[color=darkred]
                    > > > > Try turning off the option "Track name AutoCorrect info"?
                    > > > >
                    > > > > This causes a slowdown of complex forms once the design is changed.
                    > > > > --
                    > > > > Bradley
                    > > > > Software Developer www.hrsystems.com.au
                    > > > > A Christian Response www.pastornet.net.au/response
                    > > > >
                    > > > > "Jim" <jimmy.shentz@n ospam.virgin.ne t> wrote in message
                    > > > > news:42a%b.2071 0$ft.20607@news fe1-win...
                    > > > > > That's why it's so bizarre. I only build the tree once, yet when I[/color]
                    > > switch[color=darkred]
                    > > > > > between forms, it rebuilds itself extremely slowly. if i get a[/color][/color][/color]
                    chance,[color=blue][color=green]
                    > > i'll[color=darkred]
                    > > > > > try and replicate it and give you a url to a db so you can see for[/color]
                    > > yourself.[color=darkred]
                    > > > > >
                    > > > > > By the way, the problem fixes itself if i remove and readd the[/color][/color][/color]
                    tree[color=blue][color=green]
                    > > ....
                    > > but[color=darkred]
                    > > > > > only temporarily.
                    > > > > >
                    > > > > > Thanks
                    > > > > > Jim[/color][/color][/color]


                    Comment

                    Working...