Menu

#8 aedStaticText's getPosAtPixel is incorrect

open
nobody
None
5
2007-01-13
2007-01-13
bak
No

near the end of the function it should be:

else if(x >= width)
return (int (m_Caption.size() + 1));

the ">=" change occurs because it's possible the position is exactly after the last character, in which case the position is the last one, not 0 which is what it returns otherwise.

the "+ 1" change is there because the last position is actually one past the length. This is why when you clicked on textboxes to the right of text, it would go one before the last position instead of the last position.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.