What is an event?

<< Click to Display Table of Contents >>

Manual > Screen Creation Guide > Script > What are objects >

What is an event?

event

Events refer to various processing moments, such as when the mouse is clicked, when the mouse cursor is placed over a control, or when a key is pressed.

 

For example, in the case of Label control, the following events are available:

 

event

Contents

OnInitialize

Occurs once, just before the control is displayed for the first time.

OnMouseDown

Occurs when a mouse button is pressed

OnMouseUp

Occurs when the mouse button is released

...

...

 

When these events occur, you can perform various actions.

 

example)

event OnMouseUp(button)
{
	::OpenMsg("hello");
}

 

 

hint

The OnMouseUp event is an event that occurs in response to clicking the mouse. The OnMouseDown event is also called when a button is pressed, but the difference between the two is that the OnMouseDown event is called the moment the mouse is pressed, and the OnMouseUp event is called when the button is released afterwards.

Normally, if you want to execute some process when a button, etc. is pressed, you should use the OnMouseUp event rather than the OnMouseDown event. The reason for this is that, for example, if an operator realizes the operation was incorrect the moment they pressed a button and wants to cancel the operation, they can avoid the operation by moving the mouse outside the control area while still holding down the mouse button and releasing the button, without calling the OnMouseUp event.

Furthermore, the OnMouseUp and OnMouseDown events can be used not only with Button control, but with various other controls such as labels and rectangles.