[DUG] Component creation

Karl at Work karlreynolds at xtra.co.nz
Wed Sep 6 10:57:32 NZST 2006


A deafening silence.  Geez, did my last post not make sense or something?  I
guess an example was needed (attached).  How about it horse, will you drink
the water now? ;-)

Cheers,
Carl

> -----Original Message-----
> From: delphi-bounces at ns3.123.co.nz
> [mailto:delphi-bounces at ns3.123.co.nz]On Behalf Of Karl @ Work
> Sent: Monday, September 04, 2006 8:45 PM
> To: 'NZ Borland Developers Group - Delphi List'
> Subject: RE: [DUG] Component creation
>
>
> If you really need to detect any mouse click outside your
> component you're
> going to have to put in an application-wide mouse event hook
> to do that, ie.
>
>   YourHook := SetWindowsHookEx(WH_MOUSE, @YourHookProc, 0,
> GetCurrentThreadID);
>
> You will have to globally keep track of which component, if
> any, is expanded
> so that YourHookProc can contract it again on a click
> elsewhere - it sounds
> like only one can be expanded at once, so you shouldn't need
> to track all
> component instances in this case. So YourHookProc will be
> something like
> (untested):
>
> function YourHookProc(Code: Integer; WParam, LParam:
> Longint): Longint;
> stdcall;
> begin
>   if ExpandedThing <> nil then
>     case WParam of
>       WM_NCLBUTTONDOWN, WM_NCLBUTTONDBLCLK, WM_LBUTTONDOWN,
> WM_LBUTTONDBLCLK:
>         ExpandedThing.Contract;
>     end;
>   Result := CallNextHookEx(YourHook, Code, WParam, LParam);
> end;
>
> Call UnhookWindowsHookEx when you're done.
>
> Cheers,
> Carl
>
> _______________________________________________
> Delphi mailing list
> Delphi at ns3.123.co.nz
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BloatyEdit.zip
Type: application/x-zip-compressed
Size: 3542 bytes
Desc: not available
Url : http://ns3.123.co.nz/pipermail/delphi/attachments/20060905/420a4ac7/BloatyEdit.bin


More information about the Delphi mailing list