Sign in Join

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

Mailing lists / lazarus / 2008-04

Detecting when mouse leaves TPanel

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

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

Lee Jenkins

Hi all,

As mentioned in a previous post, I created a simple descendant from TPanel for a special button that I need. When the mousedown event occurs, I change the background color and then change it back on MouseUp event.

The problem is that if you mousedown on the control and then move the mouse aware from the control and *then* release the mouse, the control doesn't register the mouse up and thus, the control stays colored the "mouse down" color.

This is not the case when I use the control in Delphi.

Can someone offer suggestion to resolve this?

I'm using lazarus 0.9.24/FPC 2.2.0 on Windows, but will need it to work on linux gtk1/2.

Thanks a bunch.

Warm Regards, Lee "Everything I needed to learn in life, I learned selling encyclopedias door to door."

Reply by email

Micha Nelissen
to Lee Jenkins
Lee Jenkins wrote
The problem is that if you mousedown on the control and then move the mouse aware from the control and *then* release the mouse, the control doesn't register the mouse up and thus, the control stays colored the "mouse down" color.

This has to do with SetCapture etc. AFAIK, this has worked in the past. When you mousedown, the control tries to get the capture, so that even if the mouse leaves the control (or even the form) it still receives the mouseup also.

Micha

Reply by email

Lee Jenkins
to Micha Nelissen
Micha Nelissen wrote 11 lines
Lee Jenkins wrote: > The problem is that if you mousedown on the control and then move the mouse > aware from the control and *then* release the mouse, the control doesn't > register the mouse up and thus, the control stays colored the "mouse down" color. This has to do with SetCapture etc. AFAIK, this has worked in the past. When you mousedown, the control tries to get the capture, so that even if the mouse leaves the control (or even the form) it still receives the mouseup also. Micha

Thanks for responding, Micha.

I searched and found that function in controls.pp. Placing breakpoints at the beginning of the method(s) indicates that it is not being called, although I'm not sure where it should be called.

I'm testing a new control which I need to represent a button in a touch screen based application and the conditions for this to happen are very good in that environment. It would be very confusing to a user (and result in many phone calls) for a user to press on a button, have its color change and then not change back when they moved off of it.

Warm Regards, Lee "Everything I needed to learn in life, I learned selling encyclopedias door to door."

Reply by email

Graeme Geldenhuys
to Micha Nelissen: This has to do with SetCapture etc. AFAIK, this has worked in the past. When you…
Micha Nelissen wrote 5 lines
This has to do with SetCapture etc. AFAIK, this has worked in the past. When you mousedown, the control tries to get the capture, so that even if the mouse leaves the control (or even the form) it still receives the mouseup also.

Does LCL support nested SetCapture's? Say you create a custom combobox component and the dropdown window grabs the mouse capture, but the dropdown contains buttons (eg: Calculator ComboBox) which also call SetCapture.... When clicking the button and releasing, will it set the capture back to the dropdown window?

Regards,
- Graeme -

_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Reply by email

Lee Jenkins
to Lee Jenkins: As mentioned in a previous post, I created a simple descendant from TPanel for a special…
Lee Jenkins wrote 19 lines
Hi all, As mentioned in a previous post, I created a simple descendant from TPanel for a special button that I need. When the mousedown event occurs, I change the background color and then change it back on MouseUp event. The problem is that if you mousedown on the control and then move the mouse aware from the control and *then* release the mouse, the control doesn't register the mouse up and thus, the control stays colored the "mouse down" color. This is not the case when I use the control in Delphi. Can someone offer suggestion to resolve this? I'm using lazarus 0.9.24/FPC 2.2.0 on Windows, but will need it to work on linux gtk1/2. Thanks a bunch.

I have narrowed it down. The problem seems to be with TLabel. My component consists of a TShape and TLabel sited on a TPanel, which is why I didn't catch it.

Then I thought maybe it had something to do with having the TLabel on the TPanel so I placed a TLabel on a form by itself and the problem was replicated.

So it appears that there is a problem with the TLabel and mouse up when the cursor is moved off of the label before releasing the mouse button.

I would log this with mantis, but I can never get it to send me my password. Yes I have checked my email filters and junk folder ;)

If you care to have it sent to me manually, please email it to

lee (dot)

Thanks,

Warm Regards, Lee "Everything I needed to learn in life, I learned selling encyclopedias door to door."

Reply by email