Home » Community » Newbie corner » Conceptual Query: widget functions access
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: Tue May 14 15:14:48 CEST 2024
Total time taken to generate the page: 0.02609 seconds
|