ONCLICK question

Moderator: Rathinagiri

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

ONCLICK question

Post by asharpham » Mon Apr 09, 2018 7:29 am

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: 543
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia
Has thanked: 12 times
Been thanked: 97 times

Post by dragancesu » Mon Apr 09, 2018 9:39 am

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

What do you wnt?

User avatar
bpd2000
Posts: 1017
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 164 times
Been thanked: 72 times

Post by bpd2000 » Mon Apr 09, 2018 10:11 am

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
Has thanked: 14 times

Post by asharpham » Mon Apr 09, 2018 1:32 pm

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: 945
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 16 times
Been thanked: 40 times
Contact:

Post by andyglezl » Mon Apr 09, 2018 2:23 pm

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