on 05-25-2006 8:45 AM
Hi people. Well I have been doing Add Ons only for the past 2 weeks now but I have got up and running pretty fast. However I was running into a bit of problems with cathing Item Events from SBO cos I would add my items to an existing form without any trouble but then the changes just would not stick cos on testing i open the form and the items are there on form load but then close and open the form and the items are no longer there and events were just not being caught. The solutions was that i was catching my events wrong e.g:
If (<i>pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD</i>) Then
If pVal.FormType = 150 Then
oForm = SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)
'//Add my items
'add caption
oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Top = 67
oItem.Left = 275
lblBranch = oItem.Specific
lblBranch.Caption = "Caption"
End If
End If
The solution came in just adding this:
If (<i>pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD And Not pVal.Before_Action</i>) Then
If pVal.FormType = 150 Then
oForm = SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)
'//Add my items
oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem.Top = 67
oItem.Left = 275
lblBranch = oItem.Specific
lblBranch.Caption = "Caption"
End If
End If
Well hope it helps someone!
I would do a bit different if I was you...
oForm = SBO_Application.Forms.GetForm(pVal.FormType, pVal.FormTypeCount)
works better with (Using other events)
oForm = SBO_Application.Forms.Item(FormUID);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.