- Default events
- Optional events
- Overview
- Optional event: Allow closing
- Optional event: Resizing
- Optional event: Focus gain
- Optional event: Loss of focus
- Optional event: Whenever modifying
- Optional event: Move application to the foreground
- Optional event: Move the application to the background
- Optional event: Change layout
- Optional event: Application of light/dark theme
- Optional event: Start scrolling
- Optional event: While scrolling
- Optional event: Stop scrolling
Events associated with windows
WINDEV and WINDEV Mobile manage the following events by default (order of appearance in the code editor): | | Event | Runtime condition |
---|
Global declarations | Declaration of variables global to the window. This is the first code run when opening the window. | End of initialization | Run when the window is opened. The events are run in the following order:- Initialization of the window controls (*)
- Initialization of the window
- Focus gain
Remark: A blinking effect may appear if the code for updating the controls is included in this event. Indeed, the initialization code of controls is run before the update code. | Closing | Executed when closing the window. Remarks: - Resuming the input in one of the window controls in this code prevents from closing the window.
- If the window contains a "Cancel" Button, only the click code of this button is executed when the window is closed.
| Request for refreshing the display | Used to group the code for updating the window controls: content of controls, state (visible, grayed, etc.), caption to refresh, etc. This event can receive parameters. Simply declare a procedure in the event. For example:
// Request for refreshing the display PROCEDURE AskForRefresh(RefreshType is boolean)
This event is started upon request by the following functions: When these functions are called, you can specify the value of the parameters expected by the event. | | Run when the user turns the screen around. This allows you to reposition the controls when changing the orientation of the screen. | Closing a child window of the window | Run when closing a child window opened from the current window. You can: - use the Name property to get the name of the child window that was closed.
- use the ReturnedValue property to get the return value of the child window.Example:
// -- Close a child window of WIN_OrderList // Refreshes the list of orders if necessary IF MyChildWindow.ReturnedValue = True THEN OrderList() END
The MyChildWindow keyword is used to manipulate the child window. | | Used to update the widget content. This event is run:- when opening a Widget window.
- at regular time interval. This interval is defined in the "Details" tab of the description window.
Remark: WidgetDisplay redisplays the widget and runs the refresh event. |
(*) By default, the "Initializing" event of each control is executed according to the order in which the controls were created in the window. To modify this order of execution: - On the "Window" tab, in the "Order" group, click "Initialization".
- In the window that appears, use the arrows on the right to change the order in which the controls are initialized.
Caution: If one or more controls use the persistence of controls, the "Whenever modified" code can be run when initializing the control. For more details, see Persistence of controls. Overview Several optional events are supported.
To add an optional event: - Select the desired control.
- Display the code window of this control (F2 key).
- Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
- All the optional events available for the control are displayed.
- Check the optional event to add and validate.
Remark: You can select several optional events. - The selected optional event is automatically added to the events managed by the control.
To disable an optional event, simply perform the same operations to display the list of optional events. Then simply uncheck the optional events to delete. Remark: If the disabled code contains WLanguage code, this code is automatically deleted. You can manage the following aspects, for example: Optional event: Allow closing This event can be used to make a verification when the window is closed, right before the "Closing" event is executed. This event can be used to: - request a confirmation,
- prevent the window from closing. To do so, simply write the following line of code:
Caution: - if the window contains a "Cancel" Button, only the click code of this button is executed when the window is closed.
- the "Allow closing" event is executed only when the window is closed via the "X" button. This event is not executed when Close is called.
Optional event: Resizing Run in the following cases: - Minimizing the window
- Enlarging or resizing the window
- Restoring the window once it was minimized
Optional event: Focus gain Run when the window gains focus (the title bar is active) and when another window loses focus: This event will not be executed: - when opening the first project window.
- when running OpenChild, OpenMobileWindow or OpenSister from the current window.
- if Close is called in the window initialization code.
- if the user clicks a window of another program then re-clicks the initial window.
Optional event: Loss of focus Run when the window loses focus when going to another window. This event is always called before the focus gain event of another window in the following cases: - closing the window (before the closing event)
- the user clicked another window of the application
- SetFocusAndReturnToUserInput was run from another window of the application
This event will not be executed: - if SetFocusAndReturnToUserInput to another window was run in the window initialization code
- if Close is called in the window initialization code
- if the user clicks a window of another program then re-clicks the initial window
Optional event: Whenever modifying Run when one of the window controls is modified (input performed by the user for example). Optional event: Start scrolling Executed when the user starts scrolling a window. This event is used to scroll through the content, if necessary. For example, with this event you can make a control appear when the bottom of the window is reached or when the scrollbar goes up. Reminder: ScrollbarPosition gets the position of the scrollbar. Optional event: While scrolling Executed when the user scrolls the window. This event is used to scroll through the content, if necessary. For example, with this event you can make a control appear when the bottom of the window is reached or when the scrollbar goes up. Reminder: ScrollbarPosition gets the position of the scrollbar. Optional event: Stop scrolling Executed when the user stops scrolling the window. This event is used to scroll through the content, if necessary. For example, with this event you can make a control appear when the bottom of the window is reached or when the scrollbar goes up. Reminder: ScrollbarPosition gets the position of the scrollbar.
This page is also available for…
|
|
|
|