Board index » delphi » Sender Object

Sender Object

What I need is to know the index of the Component Index of the Sender
Is there an equivalent to the following code for the sender object?

I:=PopupMenu1.PopupComponent.ComponentIndex

This is great for pop-up menus but it doesn't work with components.

I have looked through the documentation and many other sources of
information and I have not found it yet.  

This is all that I can find:

if Sender=BitBtn then

and

for I:=0 to ComponentCount-1 do

This is not very efficient when it involves lots of components, the
DLL/executable gets very large quickly.

Does anyone have an idea?

--
Alexander Medwedew
Computer Ventures, Inc.
compv...@tribeca.ios.com
http://tribeca.ios.com/~compvent/

 

Re:Sender Object


Quote
Alexander Medwedew <compv...@tribeca.ios.com> wrote:
>What I need is to know the index of the Component Index of the Sender
>Is there an equivalent to the following code for the sender object?

>I:=PopupMenu1.PopupComponent.ComponentIndex

I'm not sure why you need the index into the component array, since you
already have a reference to the sending object in Sender, but maybe you
could use the Tag property of the objects. Initialise this at form
creation and then use it in your code.

    Component[Sender.Tag]

Keith Wood

Other Threads