on 04-22-2004 11:12 AM
Hello all
I've created a VERY simple form with a button on it. This is the code:
'Create the form:
frmVareAddOn = SBO_Application.Forms.Add("VareAddOnForm")
frmVareAddOn.Height = 599
frmVareAddOn.Left = 275
frmVareAddOn.Title = "My button-form"
frmVareAddOn.Top = 48
frmVareAddOn.Width = 473
'Create the button
oItem = frmVareAddOn.Items.Add("btnHello", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Height = 19
oItem.Left = 365
oItem.Top = 28
oItem.Width = 65
oButton = oItem.Specific
oButton.Caption = "Hello"
When I run the project, the form with the button is shown - but how can I show a MessageBox when the button is clicked?
Thank you for posting.
I am now catching the events, when my buttons are clicked - I do this with the ITEM_PRESSED event.
But everytime i click my button - the event happens twice... I get the messagebox two times in a row. How do I solve this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henrik,
several events will come twice:
Before and after SBO performs it's own tasks in reaction to the specific event, you are informed about that.
The property of the ItemEvent object reflecting this is
"Before_Action". The UI API helpfile states that this "Returns a value specifying if the event was issued before SAP Business One application handled the event."
To prevent further processing by SBO etc. in case of "Before_Action=True", set "BubbleEvent" to False. (See "Remarks" to the ItemEvent Event)
Regards,
Frank
Hello Henrik,
see then ItemEvent of the Application Object in UI Help-File.
There is also a sample named "CatchingEvents Sample".
hth, Stephan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Henrik,
you can catch an item event for this.
Please
- check the "Catching events" sample in the "Developer area" for "SAP Business One" for details and/or
- see the help file for SAP Business One UI API ("Programming with the UI API" / "Event Handling" / ...) or
- see the help file for SAP Business One UI API ("UI API Reference" / "Overview" / "Events" / "Item Events").
In VB .NET e.g. the handler looks like this:
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
"pVal" contains all the information you need for your purposes.
In addition please "search" the UI API helpfile for further information about "MessageBox"...
Regards,
Frank
PS (Just FYI): There's a training course for the SBO SDK (TB1300) that will help you to get started with SDK development.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
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.