Page 1 of 2
:onclick on bitmap not working
Posted: Sun Oct 09, 2011 2:22 pm
by Ricci
If I try to assign a

nClick( { || .... } ) to a bitmap object, I get a QLABEL:CONNECT(0) error.
BITMAP inherits this method from LABEL and BASIC (over CONTROL). But which of them is chosen?
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 12:47 pm
by l3whmg
Hi Ricci.
You are right: BITMAP inherits from LABEL....but (and I'm not a guru):
1) LABEL must be aligned about event handling, but this, probably, it's not the most important problem.
2) within LABEL, you can see there is an overwrite about OnClick method and a ProcessMouseKey. Why this? Because, QLabel (QT real object) doesn't has the same signal as button: we must catch "when a mouse button is pressed....."
For this reasons (I think) the onclick upon bitmap can't work properly.
This is my little opinion: I will investigate much more.
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 1:01 pm
by mrduck
Ricci wrote:If I try to assign a

nClick( { || .... } ) to a bitmap object, I get a QLABEL:CONNECT(0) error.
BITMAP inherits this method from LABEL and BASIC (over CONTROL). But which of them is chosen?
This line
is wrong....
Should be
since Label derives from Control...
As Luigi said, QLabel overrides method onClick since it doesn't have the clicked() signal.... and probably the double (circular) inheritance let the class use the basic:onClick method...
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 2:11 pm
by Ricci
mrduck wrote:
Should be
since Label derives from Control...
Well done, Francesco. This solve the problem, now it´s working.
Thanks ... Ricci
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 2:16 pm
by Ricci
Btw. can anyone put this extension of onclick in IMAGE to hmg.ch into SVN please:
Code: Select all
/*----------------------------------------------------------------------*/
// Image
/*----------------------------------------------------------------------*/
#xcommand DEFINE IMAGE <tagreference> ;
[ <dummy1: OF, PARENT> <oParent> ] ;
[ TOVAR <varname> ] ;
[ AT <nRow> , <nCol> ] ;
[ ROW <nRow> ] ;
[ COL <nCol> ] ;
WIDTH <nWidth> ;
HEIGHT <nHeight> ;
PICTURE <cPicture> ;
[ BACKCOLOR <aBackColor> ] ;
[ TOOLTIP <cToolTipText> ] ;
[ <lTabStop : TABSTOP> ] ;
[ <lStretch : STRETCH> ] ;
[ <lScaledToHeight : SCALEDTOHEIGHT> ] ;
[ <lScaledToWidth : SCALEDTOWIDTH> ] ;
[ <dummy2: ACTION,ON CLICK,ONCLICK> <bOnClick> ];
=>;
With Object [<varname> :=] BITMAP():New(<"tagreference"> [ , <oParent> ]) ;;
[:Row := <nRow> ] ;;
[:Col := <nCol> ] ;;
[:Width := <nWidth> ] ;;
[:Height := <nHeight> ] ;;
[:Picture := <cPicture> ] ;;
[:BackColor := <aBackColor> ] ;;
[:ToolTip := <cToolTipText> ] ;;
[:TabStop := <.lTabStop.> ] ;;
[:Stretch := <.lStretch.> ] ;;
[:ScaledToHeight := <.lScaledToHeight.> ] ;;
[:ScaledToWidth := <.lScaledToWidth.> ] ;;
[:OnClick := <{bOnClick}> ] ;;
End With
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 5:17 pm
by l3whmg
Hi Ricci,
could you please give me a little example of your code?
Because I coded this
Code: Select all
DEFINE IMAGE image1
ROW 10
COL 10
ONCLICK MsgInfo("This")
WIDTH 100
HIGHT 100
END IMAGE
and work fine.
IMHO, about your referred command it seem "not very good". If you take a look, there is another "define image" command.
Anyway, please give me your example.
Thanks
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 6:25 pm
by Ricci
l3whmg wrote:
IMHO, about your referred command it seem "not very good". If you take a look, there is another "define image" command.
Anyway, please give me your example.
Thanks
Sorry, I mean "extend the current definition" of "define image" in HMG.CH, only add the 2 new lines.
Code: Select all
DEFINE IMAGE lichtF AT 379,015 WIDTH 35 HEIGHT 25 PICTURE ":lichtu" ONCLICK { || ... }
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 6:58 pm
by l3whmg
Hi Ricci.
I'm very, very

but I don't understand what you want or mean.
What lines?
This code doesn't work
Code: Select all
DEFINE IMAGE lichtF
ROW 379
COL 015
WIDTH 35
HEIGHT 25
PICTURE ":lichtu"
ONCLICK { || ... }
END IMAGE
AnyWay, please, try this or tell me if your source is an HMG3 source coded.
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 7:13 pm
by l3whmg
Hi Ricci.
Ok I understand what do you mean. But please, tell me this: do you have a HMG3 program? Or do you are coding a new program with XBase style?
Cheers
Re: :onclick on bitmap not working
Posted: Mon Oct 10, 2011 7:21 pm
by l3whmg
I'm asking to you because if you are coding a new program, you must prefer this syntax
Code: Select all
DEFINE IMAGE ImageName
ParameterName1 Value
ParameterName2 Value
ParameterNameN Value
END IMAGE
Cheers