ONCLICK question

Moderator: Rathinagiri

Post Reply
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

ONCLICK question

Post by asharpham »

Is it possible to have more than 1 "onclick" entry in a button? I want the button click to do 2 things.

Alan
User avatar
dragancesu
Posts: 921
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: ONCLICK question

Post by dragancesu »

Depends on what you want
When ON CLICK you can call a command, function, or procedure

What do you wnt?
User avatar
bpd2000
Posts: 1207
Joined: Sat Sep 10, 2011 4:07 am
Location: India

Re: ONCLICK question

Post by bpd2000 »

Simple example may help you, you may define multiple action in this way

Code: Select all

/*
 * HMG - Harbour Win32 GUI library
 * Copyright 2002-2008 Roberto Lopez <mail.box.hmg@gmail.com>
 * http://www.hmgforum.com//
*/

#include "hmg.ch"

Function Main()

   DEFINE WINDOW Form_1 ;
      AT 0,0 ;
      WIDTH 400 ;
      HEIGHT 400 ;
      MAIN;
      TITLE 'Button Test'

      @ 10,10 LABEL Label_1 AUTOSIZE VALUE 'Value before button press'
      @ 70,170 BUTTON Button_1 CAPTION	'Test_Buton' ;
        ACTION (Form_1.label_1.value := "Button 1st event", ;
                 MsGINFO("Button 2nd event"))

   END WINDOW

   CENTER WINDOW Form_1

   ACTIVATE WINDOW Form_1

Return nil
BPD
Convert Dream into Reality through HMG
asharpham
Posts: 55
Joined: Sat Mar 24, 2018 2:48 pm
DBs Used: DBF

Re: ONCLICK question

Post by asharpham »

Thanks for that. But I use "define button" and in the docs ACTION is not shown as an option. Anyway, I decided to try the same idea with "ON CLICK" and it seems to work: ONCLICK { DeleteCheck := .T. , SeekText() }.

Regards,
Alan
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ONCLICK question

Post by andyglezl »

DEFINE BUTTON <ButtonName>
PARENT <ParentWindowName>
ROW <nValue>
COL <nValue>
CAPTION <cValue>
PICTURE <cValue>
PICTALIGNMENT Top | Left | Right | Bottom

ONCLICK <ActionProcedure>

WIDTH <nValue>
HEIGHT <nValue>
FONTNAME <cValue>
FONTSIZE <nValue>
FONTBOLD <lValue>
FONTITALIC <lValue>
FONTUNDERLINE <lValue>
FONTSTRIKEOUT <lValue>
TOOLTIP <cValue>
FLAT <lValue>
TRANSPARENT <lValue>
ONGOTFOCUS <ActionProcedure>
ONLOSTFOCUS <ActionProcedure>
TABSTOP <lValue>
HELPID <nValue>
VISIBLE <lValue>
MULTILINE <lValue>
END BUTTON



@ <nRow> ,<nCol>
BUTTON <ControlName>
[ OF | PARENT <ParentWindowName> ]
CAPTION <cCaption>
PICTURE <cPictureName> [ TOP | BOTTOM | LEFT | RIGHT ]

ACTION | ONCLICK | ON CLICK <ActionProcedureName> | <bBlock>

[ WIDTH <nWidth> HEIGHT <nHeight> ]
[ FONT <cFontName> SIZE <nFontSize> ]
[ BOLD ] [ ITALIC ] [ UNDERLINE ] [ STRIKEOUT ]
[ TOOLTIP <cToolTipText> ]
[ FLAT ]
[ NOTRANSPARENT ]
[ ON GOTFOCUS <OnGotFocusProcedur> | <bBlock> ]
[ ON LOSTFOCUS <OnLostFocusProcedure> | <bBlock> ]
[ NOTABSTOP ]
[ HELPID <nHelpId> ]
[ INVISIBLE ]
[ MULTILINE ]


Is the same...
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply