CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2002
    Posts
    9

    Gui controls & Threads

    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?
    10X

    Inbal

  2. #2
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    265

    Re: Gui controls & Threads

    Take a look at the Control.Invoke method.

    The world holds two classes of men -- intelligent men without religion, and religious men without intelligence. Abu'l-Ala-Al-Ma'arri (973-1057; Syrian poet)

  3. #3
    Join Date
    Mar 2002
    Posts
    9

    Re: Gui controls & Threads

    Hi,
    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.
    Help!!!

    Inbal

  4. #4
    Join Date
    Aug 2001
    Location
    Norway
    Posts
    115

    Re: Gui controls & Threads

    Just a suggestion...
    1) Create a new thread
    2) Create new treeview (just class reference, no visuals) inside that thread
    3) Populate the thread inside the class
    4) When done, pass the reference of thread's treeview to the application's treeview and run a refresh on application's treeview



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured