How to trigger button click events programmatically?
Posted: Thu Feb 17, 2022 2:41 am
Hello,
How to trigger button click events programmatically?
How to trigger button click events programmatically?
Exclusive forum for HMG, a Free / Open Source xBase WIN32/64 Bits / GUI Development System
http://mail.hmgforum.com/
That's one way!
Code: Select all
FUNCTION Main()
DEFINE WINDOW FormMain . . . . .
@ nRen , nCol BUTTON BTN1 OF FormMain CAPTION "ALGO" WIDTH 25 HEIGHT . . . . . ONCLICK MsgBox("Title")
ON KEY CTRL+ALT+BACK OF FormMain ACTION MsgBox("Title")
ON KEY F2 OF FormMain ACTION MsgBox("Title")
DEFINE CONTEXT MENU OF FormMain
MENUITEM "ALGO" ACTION MsgBox("Title")
END MENU
END WINDOW
MsgBox("Title")
ACTIVATE WINDOW FormMain
RETURN
Code: Select all
Eval ( _GetControlAction ( <cButtonName> , <cParentWindowName> ) )Code: Select all
#include "hmg.ch"
Function Main()
set century on
set date ital
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 300 ;
HEIGHT 300 ;
MAIN;
TITLE 'Button Test'
DEFINE MAIN MENU
POPUP 'Test'
ITEM 'Disable button' ACTION Form_1.Button_1.Enabled := .f.
ITEM 'Enable button' ACTION Form_1.Button_1.Enabled := .t.
END POPUP
END MENU
@ 30,30 BUTTON Button_1 PICTURE "button.bmp" WIDTH 50 HEIGHT 50 ACTION getprinter()
@ 30,90 BUTTON Button_2 CAPTION "Sim Onclick button 1" WIDTH 150 HEIGHT 50 ACTION Sim_Onclickbutton1()
@ 150,70 textbox t1 value date() date
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
//
function Sim_Onclickbutton1()
domethod("Form_1","Button_1","onclick")
return nil