[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating Own Events

Posted on 1997-04-09
1
Medium Priority
?
191 Views
Last Modified: 2010-04-06
How do i do to write a own Event handler.
For example i have the folowing code.

TMyProc = Procedure ( Sender : TObject; Flag : byte );
TForm1 = Class ( TForm)  
  Private
  FmyProc : TMyProc;
  Public
  Property MyEvent : TMyProc read FMyProc write FMyProc;
end;

What i want to do is that when i write to the MyEvent i want the above Procedure MyProc to be executed. How do i do that.

Send answer to : martinar@algonet.se

Regards

Martin Arvidsson
0
Comment
Question by:martinar
[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:
sperling earned 100 total points
ID: 1335261
First, append 'of object' to the type declaration.

TMyProc = Procedure ( Sender : TObject; Flag : byte ) of object;



TForm1 = Class ( TForm)
Private
  FmyProc : TMyProc;
Public
  Property MyEvent : TMyProc read FMyProc write FMyProc;
end;


Call the assigned event like this:

  if Assigned(FMyProc) then FMyProc(Self, SomeValue)


Regards,

Erik.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
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. …
Suggested Courses

656 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