[DUG] Component creation

Robert martin rob at wildsoft.co.nz
Wed Sep 6 11:37:14 NZST 2006


Hi  Karl

I think I misread your original email and thought you were talking about 
the application checking for which control is active.  None the less I 
knew that this wasn't how it was done in other similar components 
(TComboBox, dropdown calendar components etc).  I have now bathed in 
water provided from a number of sources and have the definitive (or at 
least 'it works') answer.  See up coming email.....


The anticipation builds.

Rob Martin
Software Engineer

phone +64 03 377 0495
fax   +64 03 377 0496
web www.chreos.com

Wild Software Ltd



Karl @ Work wrote:
> 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
>>
>>     
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Delphi mailing list
>> Delphi at ns3.123.co.nz
>> http://ns3.123.co.nz/mailman/listinfo/delphi
>>     


More information about the Delphi mailing list