DelphiDelphiVCLPythonPython GUIWindows

OnClick Event in DelphiVCL Library

pexels thirdman 7652180

OnClick event occurs when the user clicks the control.

We use the OnClick event handler to respond when the user clicks the control. If the control has an associated action, and that action has an OnExecute method, the action’s OnExecute method responds to click events unless it is superseded by an OnClick event handler.

Usually, OnClick occurs when the user presses and releases the left mouse button with the mouse pointer over the control. This event can also occur when:

  • The user selects an item in a grid, outline, list, or combo box by pressing an arrow key.
  • The user presses the SPACEBAR while a button or checkbox has focus.
  • The user presses ENTER when the active form has a default button (specified by the Default property).
  • The user presses ESC when the active form has a cancel button (specified by the Cancel property).
  • The user presses the accelerator key for a button or checkbox. For example, if the value of the Caption property of a checkbox is ‘&Bold’, the B is underlined at run time and the OnClick event of the check box is triggered when the user presses Alt+B. However, the focus does not move to the control in these instances.
  • The Checked property of a radio button is set to True.
  • The value of the Checked property of a checkbox is changed.
  • The Click method of a menu item is called.

For a form, an OnClick event occurs when the user clicks a disabled component or in a blank area of the form.

OnClick is an event handler of type TNotifyEvent.

Here is the working example of the implementation of an OnClick event:

To see the result, let’s run the complete script:

1 4804229

 

Check out DelphiVCL which easily allows you to build GUIs for Windows using Python.

Related posts
CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And Matplotlib Library?

CodeIDELearn PythonPythonPython GUITkinter

How To Make More Than 20 ChatGPT Prompts Work With Python GUI Builders And Pillow Library?

CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How To Create A Weather App With The Python Delphi Ecosystem and Weatherstack API

CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How To Create A Music Player With The Python Delphi Ecosystem

Leave a Reply

Your email address will not be published. Required fields are marked *