Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Giving components events code so they can run dynamically

Posted on 2003-10-21
1
Medium Priority
?
144 Views
Last Modified: 2010-04-03
I have just started designing components, that i want the user to create dynamically, however i can not work out how to give them specific code in their events, eg. so that the ContextPopup will display a message
0
Comment
Question by:KiwiGraeme
[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 3

Accepted Solution

by:
philly_tee earned 1000 total points
ID: 9596245
Hi,

I am not exactly sure what you are asking - You want the user to create the component in code and then place code on the Context Popup event that will display a message, as well as having the user able to use the event?

If this is so you can override the contextpopup event, adding your code before the user's event handler is called:

{*************}

unit Memo1;

interface

uses
  SysUtils, Classes, Controls, StdCtrls, types, dialogs;

type
  TMemo1 = class(TMemo)
  private
    { Private declarations }
    FOnContextPopup : TContextPopupEvent;
  protected
    { Protected declarations }
 public
    { Public declarations }
  procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); override;
  published
    { Published declarations }

  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TMemo1]);
end;

{ TMemo1 }

procedure TMemo1.DoContextPopup(MousePos: TPoint; var Handled: Boolean);
begin
    ShowMessage('Hello');
      if Assigned(FOnContextPopup) then FOnContextPopup(Self, MousePos, Handled);

end;

end.

{**********}

HTH,

Philip
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

719 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