🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11975

Re: Binding methods to events

#11975
From: Remy Lebeau (TeamB)
Date: Thu, 01 Jan 2004 22:06
33 lines
2068 bytes
"Nik" <armstrong_louie@hotmail.com> wrote in message
news:3ff3e34b@newsgroups.borland.com...
> I have the ability to assign a method to an event in delphi
> simply by creating a function in exactly the same way the
> event requires and then assigning the OnEvent to = the
> function i created.

Only if the event itself is not declared with the "of object" clause.
Otherwise, the function in question will need to be a method of a class
rather than a standalone function.  In other words:

    // requires a standalone function
    type TEventType = function(params: whatever);

    // requires a class method
    type TEventType = function(params: whatever) of object;

> What is the equivalent to this in C++??

The same as that in Delphi.

> I have an object that I've brought into CPPB (it is a single .pas file). I
> am able to bind a method to an event very easilly in delphi but I'm not
sure
> quite how to do it in C++.

Please show the actual code.  Is the event expecting a standalone function
or a class method?  Is the actual event handler you want to use a standalone
function or a class method?


Gambit
Technical Details
Message-ID: <3ff4988e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3ff3e34b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a9208b78d316a119
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-01 14:09:25 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ff3e34b@newsgroups.borland.com>
Subject: Re: Binding methods to events
Date: Thu, 1 Jan 2004 14:06:20 -0800
Lines: 35
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.139.199
Message-ID: <3ff4988e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1072994446 67.22.139.199 (1 Jan 2004 14:00:46 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail