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

x
?
Solved

Giving components events code so they can run dynamically

Posted on 2003-10-21
1
Medium Priority
?
146 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
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

824 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