on 01-11-2017 3:44 PM - last edited on 02-03-2024 5:59 PM by postmig_api_4
public void CreateButton()
{
Item button = ...
// Create button
...
...
...
( button.Specific as Button ).ClickAfter += OnClick;
}
public void OnClick( object sboObject, SBOItemEventArg pVal )
{
// MessageBox
}
Hello. I have a question about individual item events. It is impossible to cause the event. The above code does not work. How can I rise this event (without inspection if(form && button && event_type) ). Thanks.
Hi Roman,
This boils back to the scope of your variable.
You did not declare a variable for the Button. The reference for your button item will be in local of this procedure.
Once it goes out of scope and the GC collected it, the event will not trigger anymore.
Solution is to declare an SAPbouiCOM.Button object in a place where this button object will live as long as you need it.
Usually it is a variable in your class to handle this form.
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Roman,
Your code should be work. I have tested and works fine.
Check if your code doesn't have some EventFilter config.
My SAP B1 version is 9.1 PL 12.
Hope it helps.
Kind Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Diego. You was right - it's bad EventFilter in program. Now it works.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.