:onclick on bitmap not working
Moderator: Rathinagiri
:onclick on bitmap not working
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?
BITMAP inherits this method from LABEL and BASIC (over CONTROL). But which of them is chosen?
Re: :onclick on bitmap not working
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.
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.
Luigi from Italy
www.L3W.it
www.L3W.it
Re: :onclick on bitmap not working
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
Code: Select all
CLASS BITMAP FROM CONTROL, LABEL
Should be
Code: Select all
CLASS BITMAP FROM LABEL
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
Well done, Francesco. This solve the problem, now it´s working.mrduck wrote: Should besince Label derives from Control...Code: Select all
CLASS BITMAP FROM LABEL
Thanks ... Ricci
Re: :onclick on bitmap not working
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
Hi Ricci,
could you please give me a little example of your code?
Because I coded this
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
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
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
Luigi from Italy
www.L3W.it
www.L3W.it
Re: :onclick on bitmap not working
Sorry, I mean "extend the current definition" of "define image" in HMG.CH, only add the 2 new lines.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
Code: Select all
DEFINE IMAGE lichtF AT 379,015 WIDTH 35 HEIGHT 25 PICTURE ":lichtu" ONCLICK { || ... }
Re: :onclick on bitmap not working
Hi Ricci.
I'm very, very but I don't understand what you want or mean.
What lines?
This code doesn't work
AnyWay, please, try this or tell me if your source is an HMG3 source coded.
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.
Luigi from Italy
www.L3W.it
www.L3W.it
Re: :onclick on bitmap not working
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
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
Luigi from Italy
www.L3W.it
www.L3W.it
Re: :onclick on bitmap not working
I'm asking to you because if you are coding a new program, you must prefer this syntax
Cheers
Code: Select all
DEFINE IMAGE ImageName
ParameterName1 Value
ParameterName2 Value
ParameterNameN Value
END IMAGE
Luigi from Italy
www.L3W.it
www.L3W.it