Displaying new controls and threads.

G

Guest

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
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top