Solved

Get name of object

Posted on 1998-08-23
1
162 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 50 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month9 days, 7 hours left to enroll

624 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