PDA

View Full Version : Delphi Questions Thread



UntouchableOne
07-01-2008, 10:48 PM
I hate to start a new thread for one question that I have but there was nowhere else to post this, my apologies. This could be used for further questions anyone else may have as well.

In a set of instructions, I would like an object to refer to itself. I want to call a procedure when an image is clicked but the image must be a parameter in the procedure. I have tried using "self" but it returns the form as TForm but I need the image that has just been click as TImage. I tried a variety of ways to get around this but it failed. I was hoping one of you pascal/delphi veterans may know another function or statement that I could use. Your help is appreciated.

Chippit
07-01-2008, 11:03 PM
The click event handler will have an Object argument called sender. That's your image. Just cast that to TImage.

UntouchableOne
08-01-2008, 10:23 AM
Well "Sender" will give you TObject, the type not the specific image that I need.

Chippit
08-01-2008, 10:55 AM
Just cast that to TImage.
ImageYouNeed := Sender as TImage;

UntouchableOne
08-01-2008, 11:10 AM
"feels like a complete idiot". Thanks alot Chippit. That totally slipped my mind.