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
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

808 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