【发布时间】:2017-01-25 09:35:51
【问题描述】:
在以下代码中:
void Script::OnLeftUp( wxMouseEvent& event )
{
int currentPos = GetCurrentPos();
int wordStartPos = WordStartPosition( currentPos, true );
int wordEndPos=WordEndPosition(wordStartPos, true);
wxString identifier=GetRange(wordStartPos,wordEndPos);
SetSelection(wordStartPos, wordEndPos );
event.Skip();
}
当我单击单词中的某个点时(例如,单词是hello,我在e 和l 之间左键单击),标识符被正确识别为hello。但是,只选择了he,而我希望选择整个单词hello。可能出了什么问题?如果位置错误,那么标识符的值应该是错误的,事实并非如此。
顺便说一句,我在 Windows 10 上使用 wxWidgets 3.1。
【问题讨论】:
-
你的函数是“OnLeftUp()”,但你说的是鼠标右键。是哪一个?
-
我说的不是右键,误会见谅。
-
你试过stc样品了吗?如果普通样本没有按预期执行,请尝试使用 ekhumoro 的解决方案。
标签: c++ selection wxwidgets scintilla wxstyledtextctrl