Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / June 2007

Tip: Looking for answers? Try searching our database.

Displaying new controls and threads.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andrei - 01 Jun 2007 19:58 GMT
I have a .NET UI threading question.
I know the general rule that UI contents can't be changed from another thread.
Here's my specific situation.

I built a DLL that contains a unified GUI layout for several projects we're
working on.
The layout is basically a Form with a TableLayoutPanel (1 row, 2 columns),
call it myMainTableLayoutPanel.
Col0 contains a TreeView that we'll use to display different steps that
application takes. The TreeNodes for the tree are provided by the individual
groups when they use the DLL.
Col1 contains essentially a blank panel where each product group will plug
their own content.

As far as this main DLL is concerned, accessing the TreeView (giving it the
contents, changing color/checkboxes of the nodes) and displaying "something"
in the blank panel on Col1, all follow the delegate threading model (use
delegates and Invoke() methods).

Now we come to the individual groups that are writing what essentially is a
plugin for the DLL.
lets say I write a plugin that will display calculation of Pi in the blank
panel of Col1.

To do that, I have created a PiCalculationPane (name it piCalculatorPane)
that has some label used to print out how many digits of Pi have been
calculated so far. Basically, I am talking about dynamically changing the
contents of the pane that is displayed in blank panel.

The application that displays the blank panel runs in its own thread. How
far do I have to follow the UI threading model? If I want to update the Pi
calculation in the piCalculatorPane, do I just call
piCalculatorPane.Invoke(delegate fcn) and within fcn update the data, or do I
have to chain the Invoke call down to myMainTableLayoutPanel?

Sorry for a long and winded question,
Thanks,
Andrei
Peter Ritchie [C# MVP] - 01 Jun 2007 20:41 GMT
Controls that are children of another control must be created on the same
thread as that of the parent control.  You can't have a panel that runs on
its own thread.
Signature

Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#

> I have a .NET UI threading question.
> I know the general rule that UI contents can't be changed from another thread.
[quoted text clipped - 34 lines]
> Thanks,
>  Andrei

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.