Which Object is Clicked

Posted on 2006-04-07
Last Modified: 2010-04-05
I have a program written in Delphi 2005 VCL. I have code that puts multiple DBCharts on a page based on a users select.  I need to know what DBChart a user clicks on to determine if there is additional inforamtion I can displace for the DBChart.  How can I determine which DBChart the user has clicked on?
Question by:mcmahling
    1 Comment
    LVL 12

    Accepted Solution

    Inside your form define something like this:

      TForm1 = class(TForm)
        procedure DBChartClick(Sender: TObject);

    procedure TForm1.DBChartClick(Sender: TObject);
      if Sender is TDBChart then
          ShowMessage((Sender as TDBChart).Name);


    Then after you create the TDBCharts add something like this:

      DBChart1.OnClick := DBChartClick;
      DBChart2.OnClick := DBChartClick;
      DBChart3.OnClick := DBChartClick;

    Now when you click a DBChart you will see its name.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now