user2383818
user2383818

Reputation: 689

Capturing mouse Enter / Leave in designtime

I'm facing some difficulties to capture mouse events for a TCustomPanel component at designtime. I've tried the CMDesignHitTest returning Message.Result := 1. It works ok capturing when mouse enters the component, but fails to sense when mouse leaves. I've tried also messing with the component style, but this does not work at all. I understand (from what I gather on the Web), that after returning Message.Result := 1 on the CMDesignHitTest event, all mouse events are captured by the component, but it seems not to work with the standard OnMouseEnter / OnMouseLeave events. I wonder if anyone can get me a working sample about this issue. I thank very much in advance.

Upvotes: 2

Views: 449

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 598134

As a test, try adding a handler for the WM_NCHITTEST message and make sure that its Message.Result is getting set to HTCLIENT when the csDesigning flag is enabled in the ComponentState property. I saw some online articles that suggest HTCLIENT is needed in order for CM_DESIGNHITTEST to work.

Upvotes: 2

Related Questions