SAP Business One SDK - System Form Button Event - sapb1

I was wondering, is it possible to read or modify click event of a button that belongs to a system form in SAP Business One?

Yes, it is. Set up your form type and event type filters appropriately. Then you'll be able to attach an event handler to ItemEvent. When the handler fires, respond to events for the ItemUID of the system button you're interested in. IN your event handlers you'll typically have something like this:
If pVal.FormTypeEx = “150” And pVal.ItemUID = “1” And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.BeforeAction = True Then
'do something
End If
You can find the ID of the button by turning on System Information in the 'View' menu and hovering over the UI element. The ID and some other information is shown in the status bar.
The "OK" and "Cancel" buttons have IDs 1 and 2 on many forms.

Related

Vuetify v-select how to call change only when user select an option?

Currently the v-select change event will fires multiple times during user typing keywords.
Is there any event will be only fired if user has select an option or press Enter to select an option.
I don't want the change event be fired during user typing keywords.
V-Select#Events
Unfortunately, it looks like the change event only has a parameter that is the value of selected option. There is not event passed through for you to check what actually raised the change event. However, looking at the link above, there are other events you can use.
There is a keydown event listed here that you might be able to leverage. It takes in a keyboard event, you should be able to check what keyboard event was raise i.e. 'Enter'. There are also other events such as mousedown or mouseup.

Events not triggering when using Send To (Mail Recipient)

I have an Outlook VBA form, which (on the initialize event) loads various data into menus.
This works in normal usage, however, if you right click, send to (mail recipient) on a file or Send > Email in Word, when you click the button to load the form, the form displays but nothing in any events trigger either on the form load, or on the various click events.
Can anyone offer an explanation of why and how to work around the issue?
You need to handle the NewInspector event of the Inspectors class.
Outlook inspectors shown using Simple MAPI or mailto link do not fire inspector events. This was done on purpose.
Which particular event are you using?

VB.Net events: test if sender is another sub or function

Is there any way to test if an event linked to a control is triggered by the program, rather than by user action?
I have a scroll bar which fires events when the user moves it. I want to be able to move the scroll bar programmatically elsewhere in the code without sending these events. i.e. events should only fire when the user interacts with the control, not when I move the control via code.
I also have radio buttons and numeric up/down controls I'd like to b able to do this with.
Thanks
There maybe better ways to do this but a quick way would be to use a boolean variable that you set when you are programmatically scrolling and unset it when you're done. Then in your event check that before executing the logic.
If IsProgramaticScrolling = False Then
' Do whatever it's supposed to do when your program isn't
' scrolling via code.
End If

MS Access VBA to set current selection/record to null on a continuous form

I have a form with a subform that is a continuous form. I have a tab control that displays information related to the record selected in the continuous form; the tab control displays as soon as a record is selected/clicked. That all is grand.
However, after the user updates information in the tab control and clicks a button, I want to hide the tab control until a record is actually clicked on the continuous form.
What is currently happening is that the first record in the continuous subform is selected and I'd like for no record to be selected.
Is there a way to set the current record/selection of a continuous form to nothing or null? I've tried setting the bookmark on the continuous form to null in the button click event using Parent.SubApptList.Form.Bookmark = Null and that does not work for me.
Seems like it should be easy, but I can't figure it out.
After the button click event could you set focus to the parent form? Doing this would force the user to click on a record. Maybe I'm not fully understanding exactly what you're trying to do but if all you want is for nothing to have focus after a button event then that's the route I would take. That's assuming you don't having any on focus events for thr main form.

Event in outlook application object model to know when the first click happens on message body box?

I am developing a add-in to perform some actions when the first click happens on the message box in outlook (2013 version). I want to capture the Outlook.MailItem.Recipients as soon as the first click happens on message body box.
Possible approach to do this (just did a quick test, seems to work for 2013):
Register to NewInspector event of the Application object:
Application.Inspectors.NewInspector += ....;
In the event handler, register to the following event:
var editor = newInspector.WordEditor as Word.Document;
editor.Application.WindowSelectionChange += ....;
The handler fires when the selection changes, which is also happening when the user clicks the window.
Please note that you must keep references to all objects in this sample, else the event registrations will get lost.