Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-11

Maybe a bug: click on TImage behind another control with SetShape

9 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Fabio Luis Girardi

I don't know if this is a bug or not. I created a control from a TCustomControl that draws a polyline with a transparent background. The transparent effect has been using SetShape procedure using a bitmap of 1 bit color depth.

The "bug" (I don't know if this is a bug) is that a TImage behind of a instance of my polyline control don't receive the click messages, but a TButton instance receives.

So, I don't know if this is a bug or I have to do something in my control to send these messages to TImage behind.

Some idea?

The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141120/d7dbf2df/attachment.html>

Reply by email

Frederic Da Vitoria
to Fabio Luis Girardi

2014-11-20 19:21 GMT+01:00 Fabio Luis Girardi :

Show quoted text 12 lines
I don't know if this is a bug or not. I created a control from a TCustomControl that draws a polyline with a transparent background. The transparent effect has been using SetShape procedure using a bitmap of 1 bit color depth. The "bug" (I don't know if this is a bug) is that a TImage behind of a instance of my polyline control don't receive the click messages, but a TButton instance receives. So, I don't know if this is a bug or I have to do something in my control to send these messages to TImage behind.

I had once a similar issue with a tPanel behind another control, in Delphi. IIRC, I indeed had to forward the messages in some way to the tPanel. I can check in my archives, if you want, but I won't be able to do it before tomorrow.

Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141121/b7b4b21a/attachment.html>

Reply by email

Frederic Da Vitoria
to Frederic Da Vitoria

2014-11-21 16:01 GMT+01:00 Frederic Da Vitoria :

Show quoted text 21 lines
2014-11-20 19:21 GMT+01:00 Fabio Luis Girardi : > I don't know if this is a bug or not. I created a control from a > TCustomControl that draws a polyline with a transparent background. The > transparent effect has been using SetShape procedure using a bitmap of 1 > bit color depth. > > The "bug" (I don't know if this is a bug) is that a TImage behind of a > instance of my polyline control don't receive the click messages, but a > TButton instance receives. > > So, I don't know if this is a bug or I have to do something in my control > to send these messages to TImage behind. > I had once a similar issue with a tPanel behind another control, in Delphi. IIRC, I indeed had to forward the messages in some way to the tPanel. I can check in my archives, if you want, but I won't be able to do it before tomorrow.

I just checked. Sorry, my memory was wrong, I did use TButtons. But it makes sense that the uppermost control would prevent any deeper control from receiving clicks, even if the uppermost control is visually transparent.

Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141121/79c32ed6/attachment.html>

Reply by email

Fabio Luis Girardi
to Frederic Da Vitoria

I found this bug on bug tracker. I followed your idea and send a patch that solves this. I'll try another approach tomorrow.

Thank you very much!

"Frederic Da Vitoria" wrote 36 lines
2014-11-21 16:01 GMT+01:00 Frederic Da Vitoria : > > 2014-11-20 19:21 GMT+01:00 Fabio Luis Girardi : > >> I don't know if this is a bug or not. I created a control from a >> TCustomControl that draws a polyline with a transparent background. The >> transparent effect has been using SetShape procedure using a bitmap of 1 >> bit color depth. >> >> The "bug" (I don't know if this is a bug) is that a TImage behind of a >> instance of my polyline control don't receive the click messages, but a >> TButton instance receives. >> >> So, I don't know if this is a bug or I have to do something in my >> control to send these messages to TImage behind. >> > > I had once a similar issue with a tPanel behind another control, in > Delphi. IIRC, I indeed had to forward the messages in some way to the > tPanel. I can check in my archives, if you want, but I won't be able to do > it before tomorrow. > I just checked. Sorry, my memory was wrong, I did use TButtons. But it makes sense that the uppermost control would prevent any deeper control from receiving clicks, even if the uppermost control is visually transparent. -- Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141121/046b3a49/attachment-0001.html>

Reply by email

Fabio Luis Girardi
to Fabio Luis Girardi

Here is it: http://bugs.freepascal.org/view.php?id=20381

2014-11-21 22:24 GMT-02:00 Fabio Luis Girardi :

Show quoted text 43 lines
I found this bug on bug tracker. I followed your idea and send a patch that solves this. I'll try another approach tomorrow. Thank you very much! Em 21/11/2014 20:48, "Frederic Da Vitoria" escreveu: 2014-11-21 16:01 GMT+01:00 Frederic Da Vitoria : > >> >> 2014-11-20 19:21 GMT+01:00 Fabio Luis Girardi : >> >>> I don't know if this is a bug or not. I created a control from a >>> TCustomControl that draws a polyline with a transparent background. The >>> transparent effect has been using SetShape procedure using a bitmap of 1 >>> bit color depth. >>> >>> The "bug" (I don't know if this is a bug) is that a TImage behind of a >>> instance of my polyline control don't receive the click messages, but a >>> TButton instance receives. >>> >>> So, I don't know if this is a bug or I have to do something in my >>> control to send these messages to TImage behind. >>> >> >> I had once a similar issue with a tPanel behind another control, in >> Delphi. IIRC, I indeed had to forward the messages in some way to the >> tPanel. I can check in my archives, if you want, but I won't be able to do >> it before tomorrow. >> > > I just checked. Sorry, my memory was wrong, I did use TButtons. But it > makes sense that the uppermost control would prevent any deeper control > from receiving clicks, even if the uppermost control is visually > transparent. > > -- > Frederic Da Vitoria > (davitof) > > Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - > http://www.april.org >
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141122/add38f89/attachment.html>

Reply by email

Frederic Da Vitoria
to Fabio Luis Girardi

I may be wrong, but this seems different from the problem you are describing: in the bugtracker issue, the click triggers the Form handler instead of being sent to a Control. In your problem, from your description, I thought the click triggered the polyline control while you would have wanted it to be handled by the TImage which is behind the polyline. In a way, your problem is not enough transparency (in terms of who gets to handle the click event) while the bugtracker bug is too much transparency. Or did I misunderstand you?

2014-11-22 10:01 GMT+01:00 Fabio Luis Girardi :

Show quoted text 41 lines
Here is it: http://bugs.freepascal.org/view.php?id=20381 2014-11-21 22:24 GMT-02:00 Fabio Luis Girardi : I found this bug on bug tracker. I followed your idea and send a patch > that solves this. I'll try another approach tomorrow. > > Thank you very much! > Em 21/11/2014 20:48, "Frederic Da Vitoria" > escreveu: > > 2014-11-21 16:01 GMT+01:00 Frederic Da Vitoria : >> >>> >>> 2014-11-20 19:21 GMT+01:00 Fabio Luis Girardi : >>> >>>> I don't know if this is a bug or not. I created a control from a >>>> TCustomControl that draws a polyline with a transparent background. The >>>> transparent effect has been using SetShape procedure using a bitmap of 1 >>>> bit color depth. >>>> >>>> The "bug" (I don't know if this is a bug) is that a TImage behind of a >>>> instance of my polyline control don't receive the click messages, but a >>>> TButton instance receives. >>>> >>>> So, I don't know if this is a bug or I have to do something in my >>>> control to send these messages to TImage behind. >>>> >>> >>> I had once a similar issue with a tPanel behind another control, in >>> Delphi. IIRC, I indeed had to forward the messages in some way to the >>> tPanel. I can check in my archives, if you want, but I won't be able to do >>> it before tomorrow. >>> >> >> I just checked. Sorry, my memory was wrong, I did use TButtons. But it >> makes sense that the uppermost control would prevent any deeper control >> from receiving clicks, even if the uppermost control is visually >> transparent. >> >
Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141122/4bbb57b3/attachment.html>

Reply by email

Fabio Luis Girardi
to Frederic Da Vitoria

I think that we aren't talking about the same thing.

I think that a transparent control must retain clicks to another controls if it is uppermost and in front of these controls. I think that this is correct.

Polyline is a different control. The area of line is the area of the control, other area will be full transparent and must pass the events to controls behind. If you click on line, the click must be fired on Polyline object, otherwise, it must be fired on the first control behind of polyline.

The bug here is: I have two TImages and one polyline. The uppermost is TImage is positioned in a removed area (transparent) of polyline and the other TImage is the background. When I click on uppermost TImage click isn't fired on it nor on background TImage. It's fired on TForm! The same behavior happens if polyline is the uppermost control.

Using SetShape make the "click" ignore TImages and TSpeedButtons (in front or behind) positioned in a removed area of a Shaped control.

Since the click messages are processed on parent, I made the message redirection. Now I'm studing a way to check if the click is on a control area or not, to make a TControl.CMHitTest fix.

2014-11-22 7:57 GMT-02:00 Frederic Da Vitoria :

Show quoted text 61 lines
I may be wrong, but this seems different from the problem you are describing: in the bugtracker issue, the click triggers the Form handler instead of being sent to a Control. In your problem, from your description, I thought the click triggered the polyline control while you would have wanted it to be handled by the TImage which is behind the polyline. In a way, your problem is not enough transparency (in terms of who gets to handle the click event) while the bugtracker bug is too much transparency. Or did I misunderstand you? 2014-11-22 10:01 GMT+01:00 Fabio Luis Girardi : > Here is it: http://bugs.freepascal.org/view.php?id=20381 > > 2014-11-21 22:24 GMT-02:00 Fabio Luis Girardi : > > I found this bug on bug tracker. I followed your idea and send a patch >> that solves this. I'll try another approach tomorrow. >> >> Thank you very much! >> Em 21/11/2014 20:48, "Frederic Da Vitoria" >> escreveu: >> >> 2014-11-21 16:01 GMT+01:00 Frederic Da Vitoria : >>> >>>> >>>> 2014-11-20 19:21 GMT+01:00 Fabio Luis Girardi >>>> : >>>> >>>>> I don't know if this is a bug or not. I created a control from a >>>>> TCustomControl that draws a polyline with a transparent background. The >>>>> transparent effect has been using SetShape procedure using a bitmap of 1 >>>>> bit color depth. >>>>> >>>>> The "bug" (I don't know if this is a bug) is that a TImage behind of >>>>> a instance of my polyline control don't receive the click messages, but a >>>>> TButton instance receives. >>>>> >>>>> So, I don't know if this is a bug or I have to do something in my >>>>> control to send these messages to TImage behind. >>>>> >>>> >>>> I had once a similar issue with a tPanel behind another control, in >>>> Delphi. IIRC, I indeed had to forward the messages in some way to the >>>> tPanel. I can check in my archives, if you want, but I won't be able to do >>>> it before tomorrow. >>>> >>> >>> I just checked. Sorry, my memory was wrong, I did use TButtons. But it >>> makes sense that the uppermost control would prevent any deeper control >>> from receiving clicks, even if the uppermost control is visually >>> transparent. >>> >> -- Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141122/c1079c87/attachment-0001.html>

Reply by email

Fabio Luis Girardi
to Fabio Luis Girardi

The problem is the concept of "transparent".

2014-11-22 10:40 GMT-02:00 Fabio Luis Girardi :

Show quoted text 101 lines
I think that we aren't talking about the same thing. I think that a transparent control must retain clicks to another controls if it is uppermost and in front of these controls. I think that this is correct. Polyline is a different control. The area of line is the area of the control, other area will be full transparent and must pass the events to controls behind. If you click on line, the click must be fired on Polyline object, otherwise, it must be fired on the first control behind of polyline. The bug here is: I have two TImages and one polyline. The uppermost is TImage is positioned in a removed area (transparent) of polyline and the other TImage is the background. When I click on uppermost TImage click isn't fired on it nor on background TImage. It's fired on TForm! The same behavior happens if polyline is the uppermost control. Using SetShape make the "click" ignore TImages and TSpeedButtons (in front or behind) positioned in a removed area of a Shaped control. Since the click messages are processed on parent, I made the message redirection. Now I'm studing a way to check if the click is on a control area or not, to make a TControl.CMHitTest fix. 2014-11-22 7:57 GMT-02:00 Frederic Da Vitoria : I may be wrong, but this seems different from the problem you are > describing: in the bugtracker issue, the click triggers the Form handler > instead of being sent to a Control. In your problem, from your description, > I thought the click triggered the polyline control while you would have > wanted it to be handled by the TImage which is behind the polyline. In a > way, your problem is not enough transparency (in terms of who gets to > handle the click event) while the bugtracker bug is too much transparency. > Or did I misunderstand you? > > > 2014-11-22 10:01 GMT+01:00 Fabio Luis Girardi : > >> Here is it: http://bugs.freepascal.org/view.php?id=20381 >> >> 2014-11-21 22:24 GMT-02:00 Fabio Luis Girardi : >> >> I found this bug on bug tracker. I followed your idea and send a patch >>> that solves this. I'll try another approach tomorrow. >>> >>> Thank you very much! >>> Em 21/11/2014 20:48, "Frederic Da Vitoria" >>> escreveu: >>> >>> 2014-11-21 16:01 GMT+01:00 Frederic Da Vitoria : >>>> >>>>> >>>>> 2014-11-20 19:21 GMT+01:00 Fabio Luis Girardi < >>>>> >: >>>>> >>>>>> I don't know if this is a bug or not. I created a control from a >>>>>> TCustomControl that draws a polyline with a transparent background. The >>>>>> transparent effect has been using SetShape procedure using a bitmap of 1 >>>>>> bit color depth. >>>>>> >>>>>> The "bug" (I don't know if this is a bug) is that a TImage behind of >>>>>> a instance of my polyline control don't receive the click messages, but a >>>>>> TButton instance receives. >>>>>> >>>>>> So, I don't know if this is a bug or I have to do something in my >>>>>> control to send these messages to TImage behind. >>>>>> >>>>> >>>>> I had once a similar issue with a tPanel behind another control, in >>>>> Delphi. IIRC, I indeed had to forward the messages in some way to the >>>>> tPanel. I can check in my archives, if you want, but I won't be able to do >>>>> it before tomorrow. >>>>> >>>> >>>> I just checked. Sorry, my memory was wrong, I did use TButtons. But it >>>> makes sense that the uppermost control would prevent any deeper control >>>> from receiving clicks, even if the uppermost control is visually >>>> transparent. >>>> >>> > -- > Frederic Da Vitoria > (davitof) > > Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - > http://www.april.org > -- The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141122/6528956d/attachment.html>

Reply by email

Frederic Da Vitoria
to Fabio Luis Girardi: I think that we aren't talking about the same thing. I think that a transparent control…

2014-11-22 13:40 GMT+01:00 Fabio Luis Girardi :

Show quoted text 13 lines
Polyline is a different control. The area of line is the area of the control, other area will be full transparent and must pass the events to controls behind. If you click on line, the click must be fired on Polyline object, otherwise, it must be fired on the first control behind of polyline. The bug here is: I have two TImages and one polyline. The uppermost is TImage is positioned in a removed area (transparent) of polyline and the other TImage is the background. When I click on uppermost TImage click isn't fired on it nor on background TImage. It's fired on TForm! The same behavior happens if polyline is the uppermost control. From your description, this looks indeed like a bug. Maybe someone else has

ideas about this?

Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20141125/bde16ca6/attachment.html>

Reply by email