on 2005 Nov 30 5:25 PM
Hi
I can add an button to a form (the count property reflects that too) but i don't find it afterwards in the items - collection (you can reproduce the behaviour with the following code and by opening the businesspartners - form)
Tried with form.update,refresh but no success
TIA
Philipp
If pval.FormTypeEx="134" Then
If pval.BeforeAction=False And pval.EventType=SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
' Button platzieren
oForm=SBO_Application.Forms.Item(pval.FormUID)
oItem = oForm.Items.Add("kit_1",SAPBouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left=5
oItem.Top=5
oItem.Height=100
oItem.Width=100
oItem.Specific.Caption="Lala"
For Each oItem In oForm.Items
If oItem.UniqueID="kit_1" Then
SBO_Application.MessageBox("Halleluia")
End If
Next
Philipp,
Don't Add the the item and in the asme routine try to find it.
1. Add it in a routine like on the form load.
2. Find it in another routine like on a item pressed (button click).
I've found this is one of the "features" of the UI API. In your example there is no need to "find" it after you've added it...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Barend
Thanks for your suggestions i really appreciate them.My example was a simplified Version of the real usage (just to reproduce it). And there I really need to find it again.
Imagine a PutButton Sub which places dynamically a button on a system form by searching the free space itself.
Now when you call this sub more than once (when you wanna put more than 1 buton on a form) then you will ran into this issue.
Will open an SAP message.
Thanks Philipp
More Details...
after adding another item it finds the first one.
hmm somebody an idea?
If pval.FormTypeEx="134" Then
If pval.BeforeAction=False And pval.EventType=SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
' Button platzieren
oForm=SBO_Application.Forms.Item(pval.FormUID)
oItem = oForm.Items.Add("kit_1",SAPBouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left=5
oItem.Top=5
oItem.Height=100
oItem.Width=100
oItem.Specific.Caption="Lala"
oItem = oForm.Items.Add("kit_2",SAPBouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left=110
oItem.Top=5
oItem.Height=100
oItem.Width=100
oItem.Specific.Caption="Lala2"
For Each oItem In oForm.Items
If oItem.UniqueID="kit_1" Then
SBO_Application.MessageBox("Halleluia")
End If
Next
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
109 | |
8 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.