Menu

#4 BeTarget/DontBeTarget and CarbonEvents

open
nobody
None
5
2006-02-09
2006-02-09
No

If you use a WTextView in a CarbonEvents environment (i.e.,
PP_Uses_Carbon_Events = true), then there are significant drawing
problems when activating/deactiving a window containing a focused
WTextView. This problem appears to be due to calls to WText::Activate
and WText::Deactivate failing to restore the port origin.

The solution is to save and restore the port origin as follows:

void
WTextView::BeTarget()
{
StOriginState state; // <== added
if (FocusDraw())
{ // Show active selection
WText::Activate();
}
StartIdling();

// check to see if theSuperView is a LScroller. If it is, we want to
// activate it
if (mScroller != NULL && (mTextAttributes &
wasteAttr_ActDeactScroll)) {
mScroller->Activate();
}
}
-- and --
void
WTextView::DontBeTarget()
{
StOriginState state; // <== added
if (FocusDraw())
{ // Show inactive selection
WText::Deactivate();
}
StopIdling(); // Stop flashing the cursor

// check to see if theSuperView is a LScroller. If it is, we want to
// deactivate it
if (mScroller != NULL && (mTextAttributes &
wasteAttr_ActDeactScroll))
{
mScroller->Deactivate();
}
}

Discussion


Log in to post a comment.