Scrolling windows have six focus events with which you can use a focus trigger. The following table explains each focus event, and the corresponding value of the focus_type parameter required in the Trigger_RegisterFocus() function:
Focus Event |
Description |
Value of focus_type |
---|---|---|
line pre |
Occurs each time the focus moves to a new line in the scrolling window. |
TRIGGER_FOCUS_PRE |
line change |
Occurs each time any field in the line changes and the focus moves to a new line in the scrolling window. |
TRIGGER_FOCUS_CHANGE |
line post |
Occurs each time the focus moves to a new line in the scrolling window. |
TRIGGER_FOCUS_POST |
line fill |
Occurs each time a new line is displayed in the scrolling window. When you display the scrolling window initially, the fill line event runs for each line until the window is full. |
TRIGGER_FOCUS_FILL |
line insert |
Occurs each time you add a new line to the scrolling window by choosing Insert Line from the Edit menu, or using the insert line statement. |
TRIGGER_FOCUS_INSERT |
line delete |
Occurs each time you delete a line from the scrolling window by choosing Delete Line from the Edit menu, or using the delete line statement. |
TRIGGER_FOCUS_DELETE |
context menu |
Occurs when the context menu for the scrolling window line is displayed. |
TRIGGER_FOCUS_CONTEXT_MENU |
This trigger updates the Contact History window with information from the selected line in the Customers and Prospects lookup window. The item in the Contact History window changes when the user chooses a different item in the Customers and Prospects lookup window. It uses the pre line focus event (TRIGGER_FOCUS_PRE) to run a processing procedure each time the focus moves to a new line.
{Name: Startup} local integer l_result; l_result = register_focus_trigger(anonymous(window Customer_Lookup_Scroll of form Customer_Lookup), TRIGGER_FOCUS_PRE, TRIGGER_AFTER_ORIGINAL, script IG_Get_Scrollwin_Information); if l_result <> SY_NOERR then warning "Trigger registration failed."; end if;
When the trigger is activated, this trigger processing procedure sets values from the current line in the Customers and Prospects scrolling window to window fields in the Customer Contacts window.
{Name: IG_Get_Scrollwin_Information} {If the Contact History window is open, try to update it.} if isopen(form IG_Contact_History) then {Update the window only if there aren't pending changes.} if not changed(form IG_Contact_History) then 'Customer Number' of window 'Contact History' of form IG_Contact_History = 'Customer Number' of window Customer_Lookup_Scroll of form Customer_Lookup; 'Customer Name' of window 'Contact History' of form IG_Contact_History = 'Customer Name' of window Customer_Lookup_Scroll of form Customer_Lookup; 'Contact Person' of window 'Contact History' of form IG_Contact_History = ""; run script 'Customer Number' of window 'Contact History' of form IG_Contact_History; end if; end if;