size_t FalagardEditbox::getTextIndexFromPosition(const Point& pt) const
{
Editbox* w = static_cast<Editbox*>(d_window);
// calculate final window position to be checked
float wndx = CoordConverter::screenToWindowX(*w, pt.d_x);
//MODIFY:does it should subtract namespace:TextArea's left edge here?
d_window->getLookNFeel();
const WidgetLookFeel& wlf = getLookNFeel();
const Rect textArea(wlf.getNamedArea("TextArea").getArea().getPixelRect(*w));
wndx -= textArea.d_left;
//primary
//wndx -= d_lastTextOffset;
// Return the proper index
if (w->isTextMasked())
return w->getFont()->getCharAtPixel(
String(w->getTextVisual().length(), w->getMaskCodePoint()),
wndx);
else
return w->getFont()->getCharAtPixel(w->getTextVisual(), wndx);
}
select Editbox character's offset
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: select Editbox character's offset
What's the nature of the issue here? You're saying that clicking in the editbox selects / moves the caret to the wrong place due to the offset of the TextArea? I'll test that out.
CE.
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: select Editbox character's offset
maybe it's my propblem, when i change looknfeel, like below.It's let the image(set:BasicImage :imageEditBoxLeft) has some width.
the editbox like this: [beautyLeftEdge[TextArea]beautyRightEdge]
the editbox like this: [beautyLeftEdge[TextArea]beautyRightEdge]
Code: Select all
<NamedArea name="TextArea">
<Area>
<Dim type="LeftEdge" >
<ImageDim imageset="BasicImage" image="EditBoxLeft" dimension="Width" />
</Dim>
<Dim type="TopEdge" >
<AbsoluteDim value="5" />
</Dim>
<Dim type="RightEdge" >
<UnifiedDim scale="1.0" offset="-5" type="RightEdge" />
</Dim>
<Dim type="BottomEdge" >
<UnifiedDim scale="1.0" offset="-5" type="BottomEdge" />
</Dim>
</Area>
</NamedArea>
<ImagerySection name="container_normal">
<FrameComponent>
<Area>
<Dim type="LeftEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="TopEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="Width" >
<UnifiedDim scale="1" type="Width" />
</Dim>
<Dim type="Height" >
<UnifiedDim scale="1" type="Height" />
</Dim>
</Area>
<Image type="LeftEdge" imageset="BasicImage" image="EditBoxLeft" />
<Image type="RightEdge" imageset="BasicImage" image="EditBoxRight" />
<Image type="Background" imageset="BasicImage" image="EditBoxMiddle" />
</FrameComponent>
</ImagerySection>
Who is online
Users browsing this forum: No registered users and 12 guests