Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get name of object

Posted on 1998-08-23
1
Medium Priority
?
164 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
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

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

876 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