How to trigger button click events programmatically?
Moderator: Rathinagiri
How to trigger button click events programmatically?
Hello,
How to trigger button click events programmatically?
How to trigger button click events programmatically?
- Rathinagiri
- Posts: 5482
- Joined: Tue Jul 29, 2008 6:30 pm
- DBs Used: MariaDB, SQLite, SQLCipher and MySQL
- Location: Sivakasi, India
- Contact:
Re: How to trigger button click events programmatically?
Just call the function whenever required!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
South or North HMG is worth.
...the possibilities are endless.
Re: How to trigger button click events programmatically?
That's one way!
Can I send a message trigger using SENDMESSAGE()? , if possible, how to write code?
Re: How to trigger button click events programmatically?
No me queda clara la pregunta...
*----------------------------------------
The question is not clear to me...
*----------------------------------------
The question is not clear to me...
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
Andrés González López
Desde Guadalajara, Jalisco. México.
Desde Guadalajara, Jalisco. México.
Re: How to trigger button click events programmatically?
Hi, try:
viewtopic.php?p=66597#p66597
Code: Select all
Eval ( _GetControlAction ( <cButtonName> , <cParentWindowName> ) )Re: How to trigger button click events programmatically?
Hello,
or why not use :
domethod( "cWinname", "cButtonId", "ONCLICK")
Regards
Hans
or why not use :
domethod( "cWinname", "cButtonId", "ONCLICK")
Regards
Hans
Re: How to trigger button click events programmatically?
Hi Edk,
i am sorry to say but this method does exist, see button example below.
Regards
Hans
-------------------------------------------------
i am sorry to say but this method does exist, see button example below.
Regards
Hans
-------------------------------------------------
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 nilRe: How to trigger button click events programmatically?
So this method is not documed https://www.hmgforum.com/hmgdoc/data/button.htm
Re: How to trigger button click events programmatically?
Thank you very much to Rathinagiri, EDK and Hansmarc for answering,
After trying to trigger a button in a program, there are several ways:
1, doMethod (cWinname cButtonid, "onClick")
2, Eval(_GetControlAction(cButtonid, cWinname))
3, SendMessage(GetControlHandle(cButtonid, cWinname),BM_CLICK,0,0)
After trying to trigger a button in a program, there are several ways:
1, doMethod (cWinname cButtonid, "onClick")
2, Eval(_GetControlAction(cButtonid, cWinname))
3, SendMessage(GetControlHandle(cButtonid, cWinname),BM_CLICK,0,0)