Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Passing in a OnMouseDown/OnMouseUp event handler as a parameter of a function

Reply
Thread Tools

Passing in a OnMouseDown/OnMouseUp event handler as a parameter of a function

 
 
Kyzer
Guest
Posts: n/a
 
      05-05-2005
Hi all,

I have created a class which contains many TShapes, TLabels and
TPanels. What I want to be able to do is when creating this class, is
passing in a pointer to OnMouseDown and OnMouseUp events. Thereby, the
user of the class can create their own event handlers for those events.
The idea is that by passing in the event handlers, these event
handlers are assigned to the appropriate events for each of the objects
in the class. However, I am having trouble declaring the constructor:

eg.
class SpecialButton : public TObject {
__published:
TShape *TLCorner;
TShape *TRCorner; // ...etc....

__public:
__fastcall SpecialButton(TMouseEvent mouseDown, TMouseEvent
mouseUp); // ??????
};

Your suggestions on this would be greatly appreciated.

Thanks,
Kyzer

 
Reply With Quote
 
 
 
 
Jonathan Mcdougall
Guest
Posts: n/a
 
      05-06-2005
> Hi all,
>
> I have created a class which contains many TShapes, TLabels and
> TPanels. What I want to be able to do is when creating this class,

is
> passing in a pointer to OnMouseDown and OnMouseUp events. Thereby,

the
> user of the class can create their own event handlers for those

events.
> The idea is that by passing in the event handlers, these event
> handlers are assigned to the appropriate events for each of the

objects
> in the class. However, I am having trouble declaring the

constructor:
>
> eg.
> class SpecialButton : public TObject {
> __published:


What's __published?

> TShape *TLCorner;
> TShape *TRCorner; // ...etc....
>
> __public:


What's __public?

> __fastcall SpecialButton(TMouseEvent mouseDown, TMouseEvent
> mouseUp); // ??????


What's __fastcall?
>
> };
>
> Your suggestions on this would be greatly appreciated.


What's the problem?


Jonathan

 
Reply With Quote
 
 
 
 
Duane Hebert
Guest
Posts: n/a
 
      05-06-2005

"Kyzer" <> wrote in message news: oups.com...
> Hi all,
>
> I have created a class which contains many TShapes, TLabels and
> TPanels. What I want to be able to do is when creating this class, is
> passing in a pointer to OnMouseDown and OnMouseUp events. Thereby, the
> user of the class can create their own event handlers for those events.
> The idea is that by passing in the event handlers, these event
> handlers are assigned to the appropriate events for each of the objects
> in the class. However, I am having trouble declaring the constructor:
>
> eg.
> class SpecialButton : public TObject {
> __published:
> TShape *TLCorner;
> TShape *TRCorner; // ...etc....
>
> __public:
> __fastcall SpecialButton(TMouseEvent mouseDown, TMouseEvent
> mouseUp); // ??????
> };
>
> Your suggestions on this would be greatly appreciated.

Try newsgroups.borland.com and look for a discussion with
VCL in the title. You'll get better help there. What you probably
want to do is to define a virtual function called by the event and allow
a derived class to override it.

BTW, even Borland doesn't support __public: AFAIK.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to function not expecting parameter Mister B C Programming 8 08-26-2010 08:01 AM
Event Handler that creates adds another event handler kaczmar2@gmail.com ASP .Net 1 02-22-2007 07:37 AM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
Passing event from dynamically created element and event handler? Adi Javascript 2 02-23-2004 02:44 PM
Passing parameter in an event handler under Mozilla Paul Cotney Javascript 0 07-11-2003 04:55 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57