472,779 Members | 1,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,779 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 2871
> 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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.