Home » Community » Newbie corner » Conceptual Query: widget functions access
Conceptual Query: widget functions access [message #27441] |
Sat, 17 July 2010 23:46 |
281264
Messages: 270 Registered: June 2010 Location: Spain
|
Experienced Member |
|
|
Hi,
I have a query regarding the access to widget’s functions, once the widget is already placed within the TopWindow of an application.
For instance, I would like to change the cursor’s image when the cursor is hovering above a toolbar or any other widget.
Yes, I can “fabricate” my version of the widget in question (as derived class) and override the virtual function MouseMove; but once this is done, how to access that widget’s function from the TopWindow?
Thanks,
Javier
|
|
|
|
|
|
Re: Conceptual Query: widget functions access [message #27468 is a reply to message #27451] |
Mon, 19 July 2010 13:33 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
There are a few things (besides coding style):
virtual void MouseMove (Point p, dword d){
pos_x=p.x;
pos_y=p.y;
Refresh();
}
virtual void Paint(Draw& w){
w.DrawRect(GetSize(), White());
w.DrawText(10, 10, AsString(pos_x));
w.DrawText(10, 20, AsString(pos_y));
}
This can be replaced by the more concise:
virtual void Paint(Draw& w){
w.DrawRect(GetSize(), White());
w.DrawText(10, 10, AsString(GetMouseViewPos()));
}
this code contains a bug:
virtual Image CursorImage (Point p, dword d){
Image img=T::CursorImage(p,d);
if(img=Image::Arrow()) <-- Should be ==
img=Images::linguist_prev();
return img;
}
and you can remove cursorimage and SetCursorImage, since you don't use them.
To use .iml files in header and source you include iml_header.h and iml_source.h in the .cpp file with the same IMAGE* defines.
|
|
|
Goto Forum:
Current Time: Fri Mar 29 07:14:07 CET 2024
Total time taken to generate the page: 0.01343 seconds
|