I'm using Delphi 7. I want to react on click(left) on empty space of PageControl -- on area righter than the last tab shown. How can i do that?
You can handle the click at the parent control of the PageControl. F.i. if the PageControl is placed on a form, the form's 'MouseDown' events will be called for that specified region. The reason is that the PageControl returns HTTRANSPARENT
for hit test messages for that region, so the mouse messages is directed to the control beneath it.
If that's not OK, you can change how WM_NCHITTEST
is handled, for example by subclassing the control, or in a derived control:
type
TMyPageControl = class(TPageControl)
protected
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
end;
procedure TMyPageControl.WMNCHitTest(var Message: TWMNCHitTest);
begin
inherited;
if Message.Result = HTTRANSPARENT then
Message.Result := HTCLIENT;
end;
then, the control's OnMouseDown
event will be fired. Of course you could test for the region before modifying the message's return value, this example was only to show how it would work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With