[SOLVED] Showdialog parent problem

0
0

Hi,
I explain the problem with this video: https://www.eprime.it/temp/wisejshodwialog1.zip
1) in a desktop application, open a FormX, and a children FormX2 with showdialog
2) open another main FormY
3) close the FormX2
4) now FormY is the new showdialog form, as if it had been opened by FormX

this problem in a desktop application it’s very limiting
regards
Cristian

  • You must to post comments
0
0

Hi Luca,
thanks to the code you wrote in this thread, I have the complete solution
https://wisej.com/support/question/form-enabled-question#sabai-entity-content-8670

I have created an Extension, that do exactly what I ask.
Instead call
Form1,showdialog()
I call
Form1.ShowWithParentLock(me)
and the parent form is locked exactly like on the desktop, and all other forms are free
it’s work wery well!

this is the code (in the forum I must put ‘[]’ instead ‘<'):
if you want you can integrate wisej ShowDialog code with this, if it is useful
[Extension]
Public Sub ShowWithParentLock(ByVal childForm As Form, ByVal parentForm As Form)
ShowWithParentLock(childForm, parentForm, Nothing)
End Sub

''' [summary]
''' Emulate showdialog function, without freezing only the parent form
''' [/summary]
''' [param name="childForm"][/param]
''' [param name="parentForm"][/param]
''' [param name="actionAfterClose"][/param]
[Extension]
Public Sub ShowWithParentLock(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.Eval("this.getBlocker().unblock();")
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.Eval("this.getBlocker().setColor('null');
this.getBlocker().setBackgroundImage(null);
this.getBlocker().block();")

childForm.Show(parentForm)
End Sub

  • You must to post comments
0
0

the only thing I don’t know how to do, is to wait until the code is executed
can you help me with this?

  • You must to post comments
0
0

The modal dialog (show dialog) and topmost and normal forms layers are different than local windows. These are not real windows, they are just <div> elements in the browser managed by a javascript WindowManager class.  There is only the z-index that simulates the 3 “layers”: normal, modal and always on top. Most javascript framework only manage 1 layer, the page and modal. The modal is simulated in a browser by adding a blocker element that stops clicks to the elements below.

Wisej also manages normal windows opened after the modal, but it has to move them to the modal z-index range. That’s what you are seeing when closing the modal in between. There is no solution at the moment other than close the modal before opening a non-modal or make the non-modal modal.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.