How to suspend modal dialog

SpeedTriple

Newcomer
Joined
Oct 24, 2004
Messages
3
Hi Guys,

I did a search and did not come up with anything helpful so I'll post my question.

I have a SDI application, I then load another winform and set it to ShowDialog() so it is modal to the main SDI winform, however, there are times when I need to allow the user to click on the main SDI window from this modal winform so I need to "suspend" the modal dialog and essentially make it modaless, any ideas how I could accomplish this?

Thanks in advance,
Mick

WinXP Pro SP2
C# 2003 Professional
 
Hi

I would think that the only way to accomplish this is to decide how you want it opened before you actually open it, maybe use an IF statement, so when the situation arises that the user is going to need to switch to the main form you open the form 'modalless': (I only do vb sorry!)

Visual Basic:
If ShowModalCondition = True Then
frmName.ShowDialog()
Else
frmName.Show()
End If
 
stustarz ,

Thanks for the response, unfortunately I can't do what you mention as I *always* load dialogs in a modal state to the main form. What I have is an application that is a drawing program, like AutoCAD and I have added the ability for an end user to automate drawing, among other tasks, via an active x scripting editor. On occassion I need to let the user "back in" to the main programs screen from my editor to interact with geometry, etc, so this is where I need to suppress modal on the editor let the user do his thing and then go back to the editor in the modal state.

I know this is an arse about face approach but I have inherited this behaviour and it is not going to change.

Anyway thanks again and hopefull someone will be able to point me in the right direction :D

Mick




stustarz said:
Hi

I would think that the only way to accomplish this is to decide how you want it opened before you actually open it, maybe use an IF statement, so when the situation arises that the user is going to need to switch to the main form you open the form 'modalless': (I only do vb sorry!)

Visual Basic:
If ShowModalCondition = True Then
frmName.ShowDialog()
Else
frmName.Show()
End If
 
Could you not display the form non-modal but make it topmost? Also you may want to handle the deactivate event for the form to decide if you really should allow the focus to be moved back to the main form.
 
Back
Top