Carl

As you look more at TActions they become more complicated - because they
work both ways
The control that implements the action is also informed of the actions
validity

My control link 'hooks' into published Tnotify Events - It also on calls
those events if they were assigned
There is always the problem of what happens if something else 'hooks' the
notify event The logic
I use is only restore the reassignment on destruction if it still points at
you.
 I'll sent you the code tomorrow

Regards Neven

----- Original Message -----
From: Carl Reynolds <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Wednesday, June 28, 2000 6:53 PM
Subject: RE: [DUG]: Chaining events and WindowProc


> Hi Neven
>
> No I hadn't looked at TActions - I have now though, thanks for the
> suggestion!  I don't think that they can help me in this case because (if
I
> understand correctly) they provide more of a method of affecting multiple
> targets that of intercepting behaviour from those targets and acting on it
> (I haven't ever used actions in anger so please correct me if I'm wrong.
:)
>
> Does your TControlLink component "hook" into events by replacing them with
> its own event "wrappers"?  If so it would suffer from the same potential
> problems I mentioned when WindowProc is replaced, but if not I would be
very
> interested in looking at it.
>
> Cheers,
> Carl
>
> -----Original Message-----
> From: Neven MacEwan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 28 June 2000 5:36 PM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Chaining events and WindowProc
>
>
> Carl
>
> Have you been down the TAction route?
> Also I have a TControlLink Component I wrote which uses RTTI to
> 'hook' events and on this event update a dataset parameter from a publish
> property
> (source as always is free on request)
>
> Regards
> Neven
>
>
> ----- Original Message -----
> From: Carl Reynolds <[EMAIL PROTECTED]>
> To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
> Sent: Wednesday, 28 June 2000 17:38
> Subject: [DUG]: Chaining events and WindowProc
>
>
> > Suppose I have a control on my form that I want to link a certain
> component
> > to that will intercept some of the messages to the control and make it
> > behave differently; eg. suppose I want to intercept the control's
> OnKeyPress
> > event and perform an action based on it.  Assume that this control could
> > actually be any TWinControl descendant, not something I've specifically
> > created myself.
> >
> > The only way I can think of to do this is either to reassign the
control's
> > OnKeyPress event or its WindowProc to one controlled by the new
component.
> > But this is a logistical nightmare either way!  Take WindowProc for
> example:
> >
> > If my component assigns the control's WindowProc to one of its own
> > procedures on creation and assigns it to the old value on destruction
(eg.
> a
> > TDockTree does this), then that is fine as long as no other component
has
> > done the same thing.  But if I have two components (for example) and, in
> > order, create component one, create component two, free one, and free
two,
> > the WindowProc for the control will end up pointing to that of component
> one
> > - which has already been free'd!!
> >
> > I could implement a stack to hold WindowProc changes for the control,
and
> > use methods on this stack to keep things in order.  But everything will
be
> > broken if any third party component does the same thing, eg. if the
> control
> > were a docksite, because TDockTree will reassign its WindowProc at the
> point
> > it is created.
> >
> > Reassigning the OnKeyPress event would encounter similar problems.  Is
> there
> > any way around this?
> >
> > Cheers,
> > Carl
>
> --------------------------------------------------------------------------
> -
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> >
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to