Hi,
if I set Enable=false a form it is still selectable, resizable with mouse drag, and resizable by the title bar,
This do not happen in winform.
I need to emulate showdialog, without freeze all opened forms, then I use the following code extension, but there is the problem just described
regards
Cristian
this is the code of the extension
Imports System.Runtime.CompilerServices
Module Module1
Public Sub ShowWithParentFormLock(ByVal childForm As Form, ByVal parentForm As Form)
ShowWithParentFormLock(childForm, parentForm, Nothing)
End Sub
Public Sub ShowWithParentFormLock(ByVal childForm As Form, ByVal parentForm As Form, ByVal actionAfterClose As Action)
If (childForm Is Nothing) Then
Throw New ArgumentNullException("childForm")
End If
If (parentForm Is Nothing) Then
Throw New ArgumentNullException("parentForm")
End If
Dim activatedDelegate As EventHandler = Sub(sender, e)
childForm.Activate()
End Sub
AddHandler childForm.FormClosed, Sub(ByVal sender As Object, ByVal closedEventArgs As FormClosedEventArgs)
Try
parentForm.Enabled = True
parentForm.Focus()
If (actionAfterClose IsNot Nothing) Then
actionAfterClose.Invoke
End If
Finally
Try
RemoveHandler parentForm.Activated, activatedDelegate
RemoveHandler parentForm.GotFocus, activatedDelegate
If (Not childForm.IsDisposed OrElse Not childForm.Disposing) Then
childForm.Dispose()
End If
Catch ex As Exception
End Try
End Try
End Sub
AddHandler parentForm.Activated, activatedDelegate
parentForm.Enabled = False
childForm.Show(parentForm)
End Sub
End Module
This full solve the problem
https://wisej.com/support/question/showdialog-parent-problem
regards
Cristian
Hi Frank,
think of a desktop wisej application and imagine there are many “applications”.
example
application1: invoice management
application2: calculator
applicaizone3: cms
… and many others.
if just one of the applications shows a form with showdialog… all other applications will be locked.
I need that if an application shows a modal form, it is still possible to use other applications. This is what i need.
If I use TopMost, the parent form it is still focusable, and do not receive DialogResult, and other application can’t go over it.
regards
Cristian
Hi Cristian,
reading this
“I need to emulate showdialog, without freeze all opened forms”
wouldn´t it be the easiest option to just use the TopMost property and set it to true for that window ?
Or maybe I misunderstood what you´re trying to achieve ?
Can you please clarify in that case ?
Thanks in advance.
Best regards
Frank
Please login first to submit.