Home  >  Article  >  Web Front-end  >  To determine whether a command button is clicked by the mouse

To determine whether a command button is clicked by the mouse

(*-*)浩
(*-*)浩Original
2019-07-30 17:09:582823browse

To determine whether the command button is clicked by the mouse, it should be determined in the Click event of the "command button".

To determine whether a command button is clicked by the mouse

Click event: This event occurs when a mouse button is pressed and then released on an object. It also occurs when a control's value changes. For a Form object, this event occurs when a blank area or an invalid control is clicked. For a control, this type of event occurs when a specific area of ​​the control object is clicked. (Recommended learning: JavaScript Video Tutorial)

Usually, attach a Click event procedure to a CommandButton control, Menu object or PictureBox control to perform commands or command-like operations. For other applicable controls, use this event to trigger an action in response to changes in the control.

You can use the Value property of a control to test the state of the control from code. Clicking a control can generate MouseDown and MouseUp events in addition to the Click event. The order in which these three events occur varies from control to control.

For example, for the ListBox and CommandButton controls, these events occur in the following order: MouseDown, Click, MouseUp.

But for FileListBox, Label or PictureBox controls, these events occur in the following order: MouseDown, MouseUp and Click. When attaching event procedures to these related events, make sure that their operations do not conflict with each other.

If the order in which events occur in an application is important, controls should be tested to determine the order of events.

Note

To distinguish the left, middle, and right buttons of the mouse, the MouseDown and MouseUp events should be used.

If you have code in the Click event, the DlbClick event will never be fired because the Click event is the first of the two events to be fired. The result is that the mouse click is truncated by the Click event so that the DblClick event does not occur.

Click Event

This event occurs when a mouse button is pressed and then released on an object. It also occurs when a control's value changes.

For a Form object, this event occurs when a blank area or an invalid control is clicked. For a control, this type of event occurs when: Click a control with the left or right button of the mouse. For CheckBox, CommandButton, Listbox or OptionButton controls, the Click event occurs only when the left mouse button is clicked.

For more js-related technical articles, please visit the js tutorial column to learn!

The above is the detailed content of To determine whether a command button is clicked by the mouse. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn