Friends,
I have an array of TEdits.
They all use the same On Key Down method.
How can I determine (from within my On Key Down method) which TEdit called the method ?
Thanks,
Well, within TEdit::OnKeyDown(), you'll be able to use this
to refer to the object.
For the exact spot in the array, you'll have to use a find algorithm based on the this
pointer. To simplify that, you could just keep the element number in a variable stored in the object.
How can I find the ->Tag I assigned to the TEdit box ? That would determine which box the call came from...
Tx.
How can I find the ->Tag I assigned to the TEdit box ? That would determine which box the call came from...
I have no clue which class ->Tag belongs to. (Perhaps you could explain a little bit more how your classes are organized.) If it's in the TEdit class, you wouldn't even need this
pointer. You could simply refer to it as *Tag within your OnKeyPress member function.
If Tag
is not in TEdit, you'll be better off just creating a pointer to Tag
within TEdit, and then accessing it inside OnKeyPress.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.