PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

isPointInRect method

Hi! I'm trying to use isPointInRect method like this:

Code:
HRESULT InitialApplication::onStylusDown(POINT p)
{
if (isPointInRect(&textup;,p))
{
f_mainfont.setFontColor(RGB(0,128,0));
}
return ReturnCode::OK;
}


&textup; is already defined RECT, and I get an error:
..\common\src\InitialApplication.cpp(172) : error C3861: 'isPointInRect': identifier not found
Why is it so? I'm working with WM2005 project.
Hi Ryumaster,
"isPointInRect" is a method of the Utility::Rect class.
You can make your code work with the following changes:

Code:

HRESULT InitialApplication::onStylusUp(POINT p)
{
Utility::Rect myRect(textup);
if (myRect.isPointInRect(p))
{
f_mainfont.setFontColor(RGB(0,128,0));
}
return ReturnCode::OK;
}


Or even better, declare textup as a Utility::Rect instead of RECT. As Utility::Rect inherits from RECT, you can use it in the same places, but you have additional methods like "isPointInRect".
If you declare:
Code:
Utility::Rect textup;


Then you can do:

Code:

HRESULT InitialApplication::onStylusUp(POINT p)
{
if (textup.isPointInRect(p))
{
f_mainfont.setFontColor(RGB(0,128,0));
}
return ReturnCode::OK;
}


Regards,
Sergio.
Thanks a lot for answering!