473,320 Members | 2,041 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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

Jul 23 '05 #1
2 2895
> 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

Jul 23 '05 #2

"Kyzer" <ky******@hotmail.com> wrote in message news:11**********************@g14g2000cwa.googlegr 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.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Pavils Jurjans | last post by:
Hallo, I have been programming for restricted environments where Internet Explorer is a standard, so I haven't stumbled upon this problem until now, when I need to write a DOM-compatible code. ...
2
by: Bender | last post by:
Hi, I am wanting to capture an onmousedown event without firing the body tags onload event. Also, if anyone could explain why this happens that would be excellent. I can't see how an...
1
by: coolsti | last post by:
I am trying to let the user drag a rectangle over an image, which will then let the user zoom in on the dragged area. However, I am doing something wrong in implementing the onmousedown and...
1
by: sameth | last post by:
I wrote a script that uses onmousedown and onmouseup in javascript that works great in ie and firefox on windows2000. It looks as if the pocketpc 2003 ie browser dosn't support onmousedown or...
6
by: RC | last post by:
<a href="#" onmousedown="callMyFunction()">Press the mouse button</a> What I expect is when I or an user move mouse pointer over that link, and press the mouse button. Then will...
9
by: jon | last post by:
Hello, I'm trying to experiment with some javascript to do some custom dragdrop handling. I wish to use the onMouseDown event to trigger the start of my drag, and onMouseup for a potentential...
4
by: simon | last post by:
hi, I would like to separate my javascript completely from my xhtml. in the end there should be only <script type="text/javascript" src="javalib.js"></script> in the head-tag to my javascript....
1
by: NeilCarmichael | last post by:
I am flummoxed, I'm relatively new to javascript and I can't get my onmousedown onmouseup script to work. simply, I want to fire one function when I click down on a graphic and a second when I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.