473,396 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Modal Forms

Hi,

I have a menu form.
The user selects an item from then menu and it shows the maintenance form
for the item.
This maintenance form is modeless so the user can select another item to
edit from then menu at the same time.
However from the maintenance from the user can edit properties, this shows a
dialog box to edit the value, this form is modal.
I want to force the user to close the property dialog before selecting
anything else on that item maintenance form, but not block the user from
using the other maintenance form.
But if the property dialog is modal it stops the user using any other part
of the app.

Any suggestions on how the modal form can only affect its parent, but allow
other forms in the app to be selected.

Tim
Nov 21 '05 #1
3 2256
Hi Tim

I haven't tried this with sample code, so I don't know if it will work in
your situation - but it's worth a go anyway. If you set the Owner property
of the 'dialog', then you will get a floating window - it will not be modal -
but you could then respond to getting focus in the owning form to check the
OwnedForms property, and switch focus back to the owned form if it is not
nothing...

Perhaps the description is harder than the code you will write!

When you show the form, instead of ShowDialog():

newForm.Owner = Me
newForm.Show()

In the OnGotFocus override:

If Not Me.OwnedForms(0) Is Nothing Then Me.OwnedForms(0).Focus()

You'll also need to set the Owner to Nothing in the OnClosed override in the
'dialog' form so that you avoid object disposed related exceptions.

HTH

Nigel Armstrong

"Tim Marsden" wrote:
Hi,

I have a menu form.
The user selects an item from then menu and it shows the maintenance form
for the item.
This maintenance form is modeless so the user can select another item to
edit from then menu at the same time.
However from the maintenance from the user can edit properties, this shows a
dialog box to edit the value, this form is modal.
I want to force the user to close the property dialog before selecting
anything else on that item maintenance form, but not block the user from
using the other maintenance form.
But if the property dialog is modal it stops the user using any other part
of the app.

Any suggestions on how the modal form can only affect its parent, but allow
other forms in the app to be selected.

Tim

Nov 21 '05 #2
Thanks

I will try.
I have also tried threading to start the maintenance forms on a new thread.

Tim
"Nigel Armstrong" <Ni************@discussions.microsoft.com> wrote in
message news:08**********************************@microsof t.com...
Hi Tim

I haven't tried this with sample code, so I don't know if it will work in
your situation - but it's worth a go anyway. If you set the Owner
property
of the 'dialog', then you will get a floating window - it will not be
modal -
but you could then respond to getting focus in the owning form to check
the
OwnedForms property, and switch focus back to the owned form if it is not
nothing...

Perhaps the description is harder than the code you will write!

When you show the form, instead of ShowDialog():

newForm.Owner = Me
newForm.Show()

In the OnGotFocus override:

If Not Me.OwnedForms(0) Is Nothing Then Me.OwnedForms(0).Focus()

You'll also need to set the Owner to Nothing in the OnClosed override in
the
'dialog' form so that you avoid object disposed related exceptions.

HTH

Nigel Armstrong

"Tim Marsden" wrote:
Hi,

I have a menu form.
The user selects an item from then menu and it shows the maintenance form
for the item.
This maintenance form is modeless so the user can select another item to
edit from then menu at the same time.
However from the maintenance from the user can edit properties, this
shows a
dialog box to edit the value, this form is modal.
I want to force the user to close the property dialog before selecting
anything else on that item maintenance form, but not block the user from
using the other maintenance form.
But if the property dialog is modal it stops the user using any other
part
of the app.

Any suggestions on how the modal form can only affect its parent, but
allow
other forms in the app to be selected.

Tim

Nov 21 '05 #3
What about disabling the form you don't want to be useable?

--

Brian Schwartz
FishNet Components
http://www.fishnetcomponents.com
Building better tools for developers - Be part of it!


Nov 21 '05 #4

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

Similar topics

0
by: Hector | last post by:
I have a ComboBox set up in a non-modal form. When a selection is made from the ComboBox, the handler code closes the form, but then the system crashes because of an unhandled NullReferenceException....
3
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...
2
by: cassidyc | last post by:
Hi, I was wondering if anyone has come accross this issue? And if they have any solutions I have that can create new copies of itself Form1 as = new form1(); af.show(); This form can also...
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
2
by: Mike | last post by:
Hi, I'm having a problem with modal forms on windows. I've written a very short test program, with a main window and a form called from the main window. The form is set to modal with...
2
by: =?Utf-8?B?TmF0aGFuIFdpZWdtYW4=?= | last post by:
Hi, I am wondering why the .NET Framework is quite different from Win32 API when it comes to displaying system modal message boxes. Consider the four following types of system modal message...
11
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have...
2
by: diogenes | last post by:
I have created many shortcut/popup (aka context, or right-click) menus for my application - instead of toolbars or standard drop-down menus. Within my custom menu, I am using...
4
by: =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post by:
I am trying to close/dispose multiple instances of a form but because they are modal and hidden, they do not show up in My.Application.OpenForms. They must be modal, so making them modeless is not...
1
by: Mohit | last post by:
Hi all, I am working on a windows based client server application with multiple forms. All forms are having custom title bars with no default bars. There is one main form. Some forms are opened up...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.