Get name of object

Posted on 1998-08-23
Last Modified: 2010-04-04
Is it possible to get name of object like a sender?
I tryed this code but it returns nonsense:
procedure TMainForm.sb11Click(Sender: TObject);
    ctTemp : TSpeedButton;
    sbName : string;
    pTemp  : pointer;
pTemp  := Sender.ClassInfo;
ctTemp := @pTemp;
sbName := ctTemp.Name;
StBInfo.Panels[0].Text := sbName;
Thanks in advance.
Question by:Dune081198
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

erajoj earned 50 total points
ID: 1337477
Try this:

procedure TMainForm.sb11Click(Sender: TObject);
  if ( Sender is TSpeedButton )
  then StBInfo.Panels[0].Text := ( Sender as TSpeedButton ).Name;

/// John


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question