473,804 Members | 4,014 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modeless dialog as owner of a modal dialog

Hello
Can a modeless form be used as the "owner" of a modal form?

Here's the situation, from my MainForm, I have created a modeless form
using "Show" - and showed a modal form using "ShowDialog ".

For some reason, if I do any user action on my modal form, it falls
behind the MainForm.

Any clues?
Thanks
Harsh

Mar 24 '06 #1
3 2403
ha******@tamale research.com wrote:
Can a modeless form be used as the "owner" of a modal form?
Yes.
Here's the situation, from my MainForm, I have created a
modeless form using "Show" - and showed a modal form using
"ShowDialog ".
Did you use ShowDialog(this ) from the parent form?
For some reason, if I do any user action on my modal form,
it falls behind the MainForm.


Can you post a short program that shows this behaviour?

Eq.
Mar 24 '06 #2
Paul
Thanks for the reply.

I think I figured out what the problem was - a buggy(by design maybe??)
component.

I am using this third party drop down component, that basically creates
a new form on the dropdownclick event. The component uses a strange
logic to decide its parent, and that's what was causing the problem.

However, now I am having another problem.

I think its best to describe it with code, as you suggested.

In MainForm.cs:
try
{
OutlookSynchToo l tool = new
OutlookSynchToo l(OutlookSynchM ode.Normal);
tool.Owner = this;
tool.Initialize Grid(); // this method call does loads the grid in
the form with data
tool.TopMost = true;
tool.ShowDialog (this);
}

OutlookSynchToo l is extended from System.Windows. Forms.Form.

In the OutlookSynchToo l class, there is call to the second dialog:
LinkNewContactT oEntityDialog linkdialog = new
LinkNewContactT oEntityDialog(m ContactsToLink) ;
linkdialog.TopM ost = true;
mLinkEntityToCo ntactDelegate = new
LinkEntityToCon tactDelegate(li nkdialog.ShowDi alog);
if (InvokeRequired )
{
linkdialog.Invo ke(mLinkEntityT oContactDelegat e, new object[1]
{this});
}
else
{
linkdialog.Show Dialog(this);
}

OutlookSynchToo l is modal to MainForm. LinkNewContactT oEntityDialog is
modal to OutlookSynchToo l. When the input focus is in
LinkNewContactT oEntityDialog, I can still interact with the
OutlookSynchToo l dialog. I reckon this should be impossible, because of
the modal-ness - but ofcourse I am wrong.

Is this too confusing? Am I missing something?

Regards
Harsh

Mar 27 '06 #3
Hey Paul
I have figured it out. The problem was that the second form was being
created on a worker thread inside the first form. This led to the weird
behaviour.

Moving it into a Invoke, solved the problem.

Mar 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7518
by: Gord | last post by:
Hello, Can somebody point me in the righ direction? I'm trying to keep a custom dialog box 'on top' and visible above all other forms, even though it is modeless. I'm trying to make it behave just like the 'Find' dialog works within the VB 6 IDE. Even if your scrolling or typing on something else, the 'Find' dialog remains on top and visible (although it has lost focus). Using the 'Show' method for the form/dialog won't allow you to...
3
3527
by: Phil | last post by:
Does anyone know if a modeless dialog box can be made to stay open when the parent window is closed? Maybe something to do with disabling the parent/owner? I basically need to have a popup window which is always the top most browser window, but still allows the user to continue browsing using the parent browser window (therefore any onblur=self.focus() isn't suitable), and isn't closed when the parent window is. Any ideas?
8
9101
by: vince | last post by:
I have a windows app whose main dialog contains a button that launches a form. I've tried using Form.Show() to have it launch as a modeless form, but it behaves as if it's modal (i.e. parent form can't receive focus)... Can someone tell me what I need to do to make the child form modeless..??? I want to be able to alternate focus between both dialogs... thanks,
0
3193
by: Andrew | last post by:
I get a Null Reference Exception if I close a modeless form (that is, a form displayed using Show()) when a selection is made from a ComboxBox. If the form is modal (displayed using ShowDialog()) or the selection is made from, say, a ListBox, no exception is thrown. I have included a simple example below. The error message refers to Unsafe Native Methods, but the code is 100% managed. What is going on ? I am using C#.NET 2003, Standard...
1
2936
by: Bruno van Dooren | last post by:
Hi, i was finally able to get my modeless dialog box to work, but a new problem did arise. i have implemented the dialog box in a dll that is called by a command line application that is native win32 without a message pump. if i show the dialog modal, it works fine.
2
3339
by: Legendary Pansy | last post by:
Hello, I'm trying to accomplish the impossible by trying to do something equivalent of this example found here http://www.c-sharpcorner.com/Code/2003/Dec/DialogTutorial.as Starting with "Listing 2 - Changing the constructor of the modeless dialog to accept the parent object:" line and go onwards is what I'm trying to do Basically, there is the main form, and then there's the modeless form. I want the modeless form act like a modal form,...
4
4181
by: Steve | last post by:
I have the MDI MFC application ported to .NET. Now this application include mixed managed/unmanaged code. The application displays progress dialog with the cancel button during lenghtly operation. This progress dialog implemented as modeless to allow user to cancel the lenghtly operation if he wishes. At the same time I disable mainframe window to prevent user from clicking on the menu bar. Here is the segment of the code:
8
4585
by: Craig G | last post by:
i have a page with a grid that is opened in a modal dialog. when it posts back it opens a new window for the page can it postback to itself? i tried setting the target of the form showing within the dialog to "_self" but no joy Cheers, Craig
4
4448
by: Lester | last post by:
I have main application (with main window) created in C++/MFC. From there I call function in C# class library to display a modal WPF dialog. Dialog shows up OK, but it doesn't behave really modal. While it is not possible to go to the main window by clicking directly on it (dialog keeps focus), the application shows twice in the taskbar (1 entry for main window, 1 entry for the WPF dialog). Through the taskbar I can switch to main window...
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9589
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,...
0
10085
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...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
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
6858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
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
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.