You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Blue Blazes

Beginner

  • "Blue Blazes" started this thread

Posts: 15

Date of registration: Aug 14th 2009

  • Send private message

1

Thursday, August 20th 2009, 4:56pm

Simulate vbModal

I am not Java trained, but it seems there is not yet a simple implementation for: frmChild1.Show vbModal.

I was thinking of a simple way to simulate vbModal, at least externally to the user person. The idea is to disable the controls on the parent form whenever a frmChildx.Show is executed. Save the controls, so when the child form shuts down it will again activate the parent controls. In the meantime, the user must attend only (in true vbmodal fashion) to the child form before doing anything further with the parent form. Users get into lots of trouble when they have too many choices (multiple child widows open at the same time or even the same child window open multiple times). Here is just one example of how it could work.

Parent program:

Public ModalControl(100) As CommandButton ... must be some way to identify all parent controls, if necessary
Public ModalControlCount As Integer

MyParent form:

Public Sub cmdChild1_Click()
cmdChild1.Enabled = False: ModalControl(1) = MyParent.cmdChild1
cmdChild2.Enabled = False: ModalControl(2) = MyParent.cmdChild2
cmdChild3.Enabled = False: ModalControl(3) = MyParent.cmdChild3 ...etc ...
ModalControlCount = 3

MyChild1 = New frmChild1
MyChild1.Show
End Sub


cmdChild2_Click() and cmdChild3_Click() in parent form are similar to above

Each child MyChildx form:

Public Sub cmdExit_Click()
Dim I As Integer
For I = 1 To ModalControlCount
ModalControl(I).Enabled = True
Next I
Unload Me
End Sub

Public Sub Form_Deactivate()
Dim I As Integer
For I = 1 To ModalControlCount
ModalControl(I).Enabled = True
Next I
End Sub

I have tested this code and it does work. Other folks can simplify it further, but it is an idea for those needing vbModal support.

Thank you

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

2

Thursday, August 20th 2009, 5:59pm

Quoted

I am not Java trained, but it seems there is not yet a simple implementation for: frmChild1.Show vbModal.
Try to use a Dialog for modal windows. Supported since 1.4.2 (RELEASE: Jabaco 1.4.2 BETA - 2009-06-21)

Rate this thread
WoltLab Burning Board