469,648 Members | 1,407 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

How can I make a Dialog modal in a threaded application?

i've seen previous posts somewhat related to this, so i apologize if
this is redundant.

I have a main form with separate threads. When showing a dialog like
<dialog>.ShowDialog(), it functions as a non-modal instead of modal.

any help is appreciated, thanks.

Mar 22 '07 #1
4 2064
The reason this is happening is that you are most likely not running
message loops in those separate threads.

Why are you showing dialogs and using user interface controls in
separate threads anyways? Not that it's not possible, but for the vast
majority of situations, it's just not necessary.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"forest demon" <me********@gmail.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
i've seen previous posts somewhat related to this, so i apologize if
this is redundant.

I have a main form with separate threads. When showing a dialog like
<dialog>.ShowDialog(), it functions as a non-modal instead of modal.

any help is appreciated, thanks.

Mar 22 '07 #2
we do need a form/dialog for one of the threads and for it to be
modal. so, message loops are the answer? can you giude or point me
to an example? thanks...
On Mar 22, 12:14 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
The reason this is happening is that you are most likely not running
message loops in those separate threads.

Why are you showing dialogs and using user interface controls in
separate threads anyways? Not that it's not possible, but for the vast
majority of situations, it's just not necessary.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"forest demon" <mete.ha...@gmail.comwrote in message

news:11**********************@n59g2000hsh.googlegr oups.com...
i've seen previous posts somewhat related to this, so i apologize if
this is redundant.
I have a main form with separate threads. When showing a dialog like
<dialog>.ShowDialog(), it functions as a non-modal instead of modal.
any help is appreciated, thanks.- Hide quoted text -

- Show quoted text -

Mar 22 '07 #3
Forest,

Ok, so why doesn't the worker thread call Invoke on a control on the
main UI thread, and then have that method passed to Invoke handle showing
the modal dialog?

Something tells me that you need to do a lot of work to make sure that
your app is performing multi threading and UI operations correctly. You
need to sort those issues out first.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"forest demon" <me********@gmail.comwrote in message
news:11**********************@p15g2000hsd.googlegr oups.com...
we do need a form/dialog for one of the threads and for it to be
modal. so, message loops are the answer? can you giude or point me
to an example? thanks...
On Mar 22, 12:14 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
> The reason this is happening is that you are most likely not running
message loops in those separate threads.

Why are you showing dialogs and using user interface controls in
separate threads anyways? Not that it's not possible, but for the vast
majority of situations, it's just not necessary.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"forest demon" <mete.ha...@gmail.comwrote in message

news:11**********************@n59g2000hsh.googleg roups.com...
i've seen previous posts somewhat related to this, so i apologize if
this is redundant.
I have a main form with separate threads. When showing a dialog like
<dialog>.ShowDialog(), it functions as a non-modal instead of modal.
any help is appreciated, thanks.- Hide quoted text -

- Show quoted text -


Mar 22 '07 #4
thanks for the reply Nicholas .
On Mar 22, 1:48 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Forest,

Ok, so why doesn't the worker thread call Invoke on a control on the
main UI thread, and then have that method passed to Invoke handle showing
the modal dialog?

Something tells me that you need to do a lot of work to make sure that
your app is performing multi threading and UI operations correctly. You
need to sort those issues out first.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"forest demon" <mete.ha...@gmail.comwrote in message

news:11**********************@p15g2000hsd.googlegr oups.com...
we do need a form/dialog for one of the threads and for it to be
modal. so, message loops are the answer? can you giude or point me
to an example? thanks...
On Mar 22, 12:14 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
The reason this is happening is that you are most likely not running
message loops in those separate threads.
Why are you showing dialogs and using user interface controls in
separate threads anyways? Not that it's not possible, but for the vast
majority of situations, it's just not necessary.
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"forest demon" <mete.ha...@gmail.comwrote in message
>news:11**********************@n59g2000hsh.googleg roups.com...
i've seen previous posts somewhat related to this, so i apologize if
this is redundant.
I have a main form with separate threads. When showing a dialog like
<dialog>.ShowDialog(), it functions as a non-modal instead of modal.
any help is appreciated, thanks.- Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

Mar 22 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Patrick Lim | last post: by
3 posts views Thread by Andrew | last post: by
10 posts views Thread by Guadala Harry | last post: by
3 posts views Thread by | last post: by
2 posts views Thread by sthrudel | last post: by
11 posts views Thread by Zytan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.