on 08-22-2005 7:48 PM
Hi!
How can I create a form and display it as a modal window
using VB.NET?
Thanks
Zoltan Sutto
The sample 12 of the UI shows how to create a modal form.
The idea is to add a small code in the sub SBO_Application_MenuEvent and SBO_Application_ItemEvent
you set the UID value of your form in a variable when you open it, then you can add this code after the two above sub
If Not IsNothing(mst_MyModalUID) Then
Dim dsa_Form As SAPbouiCOM.Form
For Each dsa_Form In Me.SBO_Application.Forms
If dsa_Form.UniqueID = mst_FormUIDSon Then
'Form still available
Me.SBO_Application.Forms.Item(mst_FormUIDSon).Select()
BubbleEvent = False
dsa_Form = Nothing
Exit Sub
End If
Next
dsa_Form = Nothing
'Form closed, set the uid to nothing
mst_MyModalUID= Nothing
End If
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I put the code at the end of the subs SBO_Application_MenuEvent and SBO_Application_ItemEvent.
The code you supplied works except I cannot click on buttons, close the child form.
Any idea?
I have an Eventfilter for my Addon with the following events.
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_MENU_CLICK)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_CLICK)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_KEY_DOWN)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)
oFilter = oFilters.Add(SAPbouiCOM.BoEventTypes.et_LOST_FOCUS)
ok, it depends how how you handle the event.
I think you just need to let the event from your modal form going thru by adding and pval.FormUID<>mst_MyModalUID
If Not IsNothing(mst_MyModalUID) and pval.FormUID<>mst_MyModalUID Then
Dim dsa_Form As SAPbouiCOM.Form
For Each dsa_Form In Me.SBO_Application.Forms
If dsa_Form.UniqueID = mst_FormUIDSon Then
'Form still available
Me.SBO_Application.Forms.Item(mst_FormUIDSon).Select()
BubbleEvent = False
dsa_Form = Nothing
Exit Sub
End If
Next
dsa_Form = Nothing
'Form closed, set the uid to nothing
mst_MyModalUID= Nothing
End If
HTH
Sebastien
don't forget to close the message if it's works
User | Count |
---|---|
91 | |
10 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.