Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Gui controls & Threads

Gui controls & Threads

Scheduled Pinned Locked Moved C#
data-structuresquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    inbal666
    wrote on last edited by
    #1

    Hi, I want to add a large number of nodes to a tree-view, but such operation halts the app. I've tried using a separate thread, but the framework won't allow it, because the thread I've created it's the one that holds the control's windows handle. Is there a way to pass that handle? :mad: 10X Inbal

    J L 2 Replies Last reply
    0
    • I inbal666

      Hi, I want to add a large number of nodes to a tree-view, but such operation halts the app. I've tried using a separate thread, but the framework won't allow it, because the thread I've created it's the one that holds the control's windows handle. Is there a way to pass that handle? :mad: 10X Inbal

      J Offline
      J Offline
      James T Johnson
      wrote on last edited by
      #2

      First call Begin/End Update on the treeview that should speed up the process a bit because it won't try to redraw after every addtion. Then instead of calling the actual methods on the treview object you need to use the Invoke method on the object, which will marshal your calls to the thread that owns the handle. The documentation will have to be your guide on on using Invoke because I've got another 2-3 days before I'm about to tackle the same thing in my app :-P HTH, James Sonork: Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971

      I 1 Reply Last reply
      0
      • J James T Johnson

        First call Begin/End Update on the treeview that should speed up the process a bit because it won't try to redraw after every addtion. Then instead of calling the actual methods on the treview object you need to use the Invoke method on the object, which will marshal your calls to the thread that owns the handle. The documentation will have to be your guide on on using Invoke because I've got another 2-3 days before I'm about to tackle the same thing in my app :-P HTH, James Sonork: Hasaki "I left there in the morning with their God tucked underneath my arm their half-assed smiles and the book of rules. So I asked this God a question and by way of firm reply, He said - I'm not the kind you have to wind up on Sundays." "Wind Up" from Aqualung, Jethro Tull 1971

        I Offline
        I Offline
        inbal666
        wrote on last edited by
        #3

        10x, I've tried it, but the result was the same. 'Invoke' calls my method on the main thread, which means that the app stucks all the same. I need means of calling AddNode from a completely different thread, so that my main thread can still listen to user mouse clicks etc. :(( Inbal

        1 Reply Last reply
        0
        • I inbal666

          Hi, I want to add a large number of nodes to a tree-view, but such operation halts the app. I've tried using a separate thread, but the framework won't allow it, because the thread I've created it's the one that holds the control's windows handle. Is there a way to pass that handle? :mad: 10X Inbal

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          you should go down to TVN_GETDISPINFO in a WndProc override

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups