Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get name of object

Posted on 1998-08-23
1
Medium Priority
?
163 Views
Last Modified: 2010-04-04
Hi!
Is it possible to get name of object like a sender?
I tryed this code but it returns nonsense:
procedure TMainForm.sb11Click(Sender: TObject);
var
    ctTemp : TSpeedButton;
    sbName : string;
    pTemp  : pointer;
begin
pTemp  := Sender.ClassInfo;
ctTemp := @pTemp;
sbName := ctTemp.Name;
StBInfo.Panels[0].Text := sbName;
end;
Thanks in advance.
0
Comment
Question by:Dune081198
[X]
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
 
LVL 4

Accepted Solution

by:
erajoj earned 150 total points
ID: 1337477
Try this:

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

/// John

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

705 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