如何创建增量搜索选项MDI? [英] How to create increment search option MDI?
问题描述
我想在我的应用程序中为CRicheditview
创建增量搜索(类似于Visual Studio编辑器)选项.
有人可以帮助我吗?
I want to create incremental search (similar to the visual studio editor) option for CRicheditview
in my application.
Any one can help me? How could I do that?
推荐答案
我的解决方案-您应将插入符号设置回第一个字符位置,以进行下一次搜索.
My solution - You should set the caret back to the first character position for the next search.
BOOL CSimpleFinderView::Findx(CString str)
{
SendMessage(EM_SETSEL,0,0);
return FindText(str,FALSE,FALSE,FALSE);
}
问候.
Regards.
告诉我们您已经走了多远,并在此处发表具体问题.
Tell us how far you''ve gotten, and post specific questions here.
BOOL CSimpleFinderView::Findx(CString str)
{
return FindText(str,FALSE,FALSE,FALSE);
}
我已经在从CRicheditview派生的视图类中编写了上面的函数.我将从mainfrm类调用此函数.
请考虑以下示例文本呈现视图.
该功能不起作用,请删除该功能"
为了找到功能"一词,我在mainfrm预翻译消息中捕获了字符,并在每次按键时调用上述功能.
按键结果
--------------------
f | f 连接不起作用,因此请删除功能
fu |函数不起作用,因此请删除 fu nction
Findtext()选择单词函数的第二次出现.但它应该是第一个.
我觉得这个CRichEditView :: FindText()将无济于事
您还能提出其他解决方案吗?
I have wrote above function in view class derived from CRicheditview. I will call this function from mainfrm class.
Consider following example text present view.
"function is not working, so remove the the function"
To find the word "function", I traps characters at mainfrm pretranslate message and calling above function for every key pressing.
Keypressed | Result
--------------------
f | function is not working, so remove the the function
fu | function is not working, so remove the the function
Findtext() selecting the second occurrence of the word function. But it suppose to be first one.
I feel this CRichEditView::FindText() will not help
Can u suggest any other solution?
这篇关于如何创建增量搜索选项MDI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!