1. Win32Lib MleText selections
- Posted by Michael J. Sabal <m_sabal at yahoo.com> Apr 14, 2006
- 450 views
- Last edited Apr 15, 2006
I haven't been able to find anything about this specific issue in the message archives, but maybe I just missed it. I want to select the first instance of a particular phrase programmatically so that the next call to getSelectedText(myMLE) returns that phrase. I've noticed that the autoSelect function selects ALL the text in a control, but I want to be able to select a single range of text. If that's not possible, then I should at least be able to move the caret to the beginning of that word or phrase. TIA, Mike
2. Re: Win32Lib MleText selections
- Posted by "Greg Haberek" <ghaberek at gmail.com> Apr 15, 2006
- 422 views
> I haven't been able to find anything about this specific issue in the mes= sage > archives, but maybe I just missed it. I want to select the first instanc= e > of a particular phrase programmatically so that the next call to > getSelectedText(myMLE) returns that phrase. I've noticed that the autoSe= lect > function selects ALL the text in a control, but I want to be able to sele= ct a > single range of text. If that's not possible, then I should at least be = able > to move the caret to the beginning of that word or phrase. have you tried setIndex( Mle, {Start, End} ) ?? ~Greg
3. Re: Win32Lib MleText selections
- Posted by Derek Parnell <ddparnell at bigpond.com> Apr 15, 2006
- 441 views
Michael J. Sabal wrote: > > I haven't been able to find anything about this specific issue in the message > archives, but maybe I just missed it. I want to select the first instance > of a particular phrase programmatically so that the next call to > getSelectedText(myMLE) returns that phrase. I've noticed that the autoSelect > function selects ALL the text in a control, but I want to be able to select > a > single range of text. If that's not possible, then I should at least be able > > to move the caret to the beginning of that word or phrase. > setIndex(myMLE, {start, end}) where 'start' and 'end' are integers containing the positions of the first and last character in the phrase. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell
4. Re: Win32Lib MleText selections
- Posted by Michael J. Sabal <m_sabal at yahoo.com> Apr 16, 2006
- 428 views
Derek Parnell wrote: > setIndex(myMLE, {start, end}) > > where 'start' and 'end' are integers containing the positions of the first and > last character in the phrase. > > -- > Derek Parnell > Melbourne, Australia > Skype name: derek.j.parnell Thanks.
5. Re: Win32Lib MleText selections
- Posted by Michael J. Sabal <m_sabal at yahoo.com> Apr 17, 2006
- 483 views
Michael J. Sabal wrote: > > I haven't been able to find anything about this specific issue in the message > archives, but maybe I just missed it. I want to select the first instance > of a particular phrase programmatically so that the next call to > getSelectedText(myMLE) returns that phrase. I've noticed that the autoSelect > function selects ALL the text in a control, but I want to be able to select > a > single range of text. If that's not possible, then I should at least be able > > to move the caret to the beginning of that word or phrase. Here's the final routine. Thanks again for the help.
global procedure onClick_FindinDoc(integer self, integer event, sequence params) object junk atom pos sequence buffer, query -- ViewX12 is an MleText control -- ViewFindinDocEdit is an EditText control buffer = getText(ViewX12) query = getText(ViewFindinDocEdit) pos = match(query,buffer) if pos > 0 then setFocus(ViewX12) setIndex(ViewX12,{pos,pos+length(query)}) junk = sendMessage(ViewX12, EM_SCROLLCARET, 0, 0) elsif isEnabled(ViewNextButton) then onClick_ViewNextButton(self,event,params) -- refresh the MleText control with the next page of data onClick_FindinDoc(self,event,params) -- recursive event end if end procedure setHandler(ViewFindinDocButton,w32HClick,routine_id("onClick_FindinDoc"))
6. Re: Win32Lib MleText selections
- Posted by Michael J. Sabal <m_sabal at yahoo.com> Apr 17, 2006
- 447 views
Oops, I forgot to include the count(x,y) function:
function count(object lookin, object lookfor) atom found found = 0 if atom(lookin) and sequence(lookfor) then return 0 elsif atom(lookin) and atom(lookfor) and lookin=lookfor then return 1 elsif atom(lookin) and atom(lookfor) and lookin!=lookfor then return 0 else for ctr = 1 to length(lookin) do if compare(lookin[ctr],lookfor)=0 then found = found + 1 end if end for return found end if end function