Article View: borland.public.cppbuilder.nativeapi
Article #12065Re: Binding methods to events
From: Nik
Date: Thu, 01 Jan 2004 17:27
Date: Thu, 01 Jan 2004 17:27
52 lines
2596 bytes
2596 bytes
//CPPB Machine generated hpp file...
//The key here is the line directly below. This is the event I need to
make...
typedef void __fastcall (__closure *TssIPCTextMsgRecieved)(System::TObject*
Sender, AnsiString MsgBuf);
class DELPHICLASS TssSimpleIPC;
class PASCALIMPLEMENTATION TssSimpleIPC : public Classes::TComponent
{
typedef Classes::TComponent inherited;
private:
AnsiString m_Name;
//And here is where the hpp file assigns the OnMessage...
TssIPCTextMsgRecieved m_OnTextMsgRecieved;
//Then I allowed CPPB to auto create an event (using the drag and drop
component feature) JUST so i could see how the method looked with the params
and such...
//This is what it made....
void __fastcall ssSimpleIPC1TextMsgRecieved(TObject *Sender, AnsiString
MsgBuf)
//And then this is how i bind the event manually....
simpleIPC->OnTextMsgRecieved=ssSimpleIPC1TextMsgRecieved;
//and the error message is...
[C++ Error] DLLUnit.cpp(59): E2034 Cannot convert 'void (_fastcall
*)(TObject *,AnsiString)' to 'void (_fastcall * (_closure )(TObject
*,AnsiString))(TObject *,AnsiString)'
"Hans Galema" <dontusethis@dontusethis.nl> wrote in message
news:3ff3fe5b$1@newsgroups.borland.com...
> Nik wrote:
> > 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.
>
> This is probably better asked in the ...vcl.components.using/writing
newsgoup.
>
> > It doesn't seem to work when i try to do it
> > exactly the same way as delphi.
>
> In bcb C++ it goes exactly the same way.
>
> Please show your code.
>
> Hans.
Technical Details
Message-ID:
<3ff4571a$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3ff3e34b@newsgroups.borland.com> <3ff3fe5b$1@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 09:39:30 PST From: "Nik" <armstrong_louie@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3ff3e34b@newsgroups.borland.com> <3ff3fe5b$1@newsgroups.borland.com> Subject: Re: Binding methods to events Date: Thu, 1 Jan 2004 12:27:45 -0500 Lines: 54 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: 24.43.85.53 Message-ID: <3ff4571a$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1072977690 24.43.85.53 (1 Jan 2004 09:21:30 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail