473,785 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>.ShowDi alog(), it functions as a non-modal instead of modal.

any help is appreciated, thanks.

Mar 22 '07 #1
4 2224
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.co m

"forest demon" <me********@gma il.comwrote in message
news:11******** **************@ n59g2000hsh.goo glegroups.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>.ShowDi alog(), 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.guar d.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.c om

"forest demon" <mete.ha...@gma il.comwrote in message

news:11******** **************@ n59g2000hsh.goo glegroups.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>.ShowDi alog(), 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.co m

"forest demon" <me********@gma il.comwrote in message
news:11******** **************@ p15g2000hsd.goo glegroups.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.guar d.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.c om

"forest demon" <mete.ha...@gma il.comwrote in message

news:11******* *************** @n59g2000hsh.go oglegroups.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>.ShowDi alog(), 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.guar d.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.c om

"forest demon" <mete.ha...@gma il.comwrote in message

news:11******** **************@ p15g2000hsd.goo glegroups.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.guar d.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.c om
"forest demon" <mete.ha...@gma il.comwrote in message
>news:11******* *************** @n59g2000hsh.go oglegroups.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>.ShowDi alog(), 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3629
by: Patrick Lim | last post by:
Here is the problem: I have written a non-modal frame class in Java for displaying help text when a user is using an application. It works as desired in that if the user selects "help" again, the same frame is used -- this is done using a singleton. The user can do other stuff in the main window while the help window is up. However, when I have a modal dialog pop-up to get information from the user, it blocks events to the help...
0
1848
by: Nonoy of Philippines | last post by:
Hello, guys... I'm just starting to develop web applications and I have this problem regarding Session objects At some parts of my application, I open modal dialog window which also opens another window to display a report. To do this, I use the values of Sessions I initialize at the windows that called the modal dialog box. However, I noticed that the values of my Sessions were gone when I opened the modal dialog window ONLY when...
3
8152
by: Andrew | last post by:
I get a Null Reference Exception if I close a non-modal dialog (that is, a form opened with Show()) when a selection is made from a ComboBox. The error message refers to Unsafe Native Methods, but the code is 100% managed. The exception is not thrown if the dialog was modal (opened with ShowDialog()) or if the selection is made from, say, a ListBox. I have included a simple example below. I am using C#.NET 2003, Standard Edition.
4
3175
by: MechSoft | last post by:
Hi, there, I have a multi-threaded non-MFC program that will include a regular dll which would be part of the user interface, possibly a dialog based interface. I would prefer to have the user interface dll run on its own thread. How to do that? I can't find the answer from the msdn knowledge base. Thanks a lot in advance! Kate
6
11173
by: Fred | last post by:
I have implemented a dialog box (an aspx page) using showModalDialog. Because the dialog needs to process postbacks, I have implemented it in a frameset. In the top of the framset page, I have defined a title as follows: <title>My Title</title> At runtime, the text in the title bar appears like this: My Title -- Web Page Dialog
10
2756
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a preview DIV) 2. when users close the dialog, the application receives the URL to the selected graphic. 3. the modal dialog lets the users upload a new graphic if the dialog does not present them with one they are already happy with. 4. upon uploading...
3
1374
by: | last post by:
Hi to everybody, I have the following situation: I have a lengthy operation inside a desktop application - something that has to be executed on the main thread of the app (this is a must) .... server.callLennghtyOperation(...) ....
2
3688
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the dialog. To be more specific I want to have a confirmation dialog that is shown when a user clicks on a Delete button (which deletes some values from database). If Yes is pressed the delete action is processed otherwise modal dialog is closed.
11
5297
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok / dangerous? How can I force shutdown code within the dialog's Form.FormClosed event run? Zytan
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10095
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7502
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.