| View previous topic :: View next topic |
| Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Fri Oct 28, 2005 2:22 am Post subject: Search and replace for an edit box. |
|
|
Anyone have some code to share that is a search and replace for an edit box? Like the search and replace for notepad or any other text editor for that matter. I am finishing up my HTML editor and I have a find and find next, but I would really like to have a replace/replace all function as well and I am haveing a bit of trouble with it.
Thanks a lot.
_________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
Posted: Fri Oct 28, 2005 10:31 am Post subject: |
|
|
chris,
not sure if i understand your querry but would using string.dll do the trick for you?
it's very easy to use and it can easily do REPLACE for you
serge
_________________
|
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Fri Oct 28, 2005 2:25 pm Post subject: |
|
|
I do have string dll, but I want a real time replace like windows notepad. See attached image.
| Description: |
|
| Filesize: |
24.12 KB |
| Viewed: |
1243 Time(s) |

|
_________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
ShinobiSoft Professional Member


Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Fri Oct 28, 2005 2:37 pm Post subject: |
|
|
Hi Chris,
Here's a 'Find' snippett. Should be able to easily add 'Replace' to it.
| Code: |
REM %%line is the current line number or the line number where the caret is
%%fndTxt = @input(Enter search text,%%fndTxt)
REM Char index is the zero based position from the beginning of the string
REM to the current pos of the caret.
REM %%charIndex = @richedit(charIndex,%%ed1)
if @not(@null(%%fndTxt))
list create,1
list assign,1,@dlgtext(Ed2)
list seek,1,%%line
%%text = @substr(@text(7),%%charIndex,@len(@text(7)))
%M = @match(1,%%fndTxt)
%%nLine = @index(1)
%P = @pred(@pos(%%fndTxt,%%text))
REM Change the following to use the corresponding @sendmsg()
REM edit control messages.
REM richedit setsel,%%ed1,%P,@sum(%P,@len(%%fndTxt))
REM richedit scrollCaret,%%ed1
list close,1
end
|
Hope this helps, as it is all I can locate at the moment.
Looking over this code, I'm not sure where the reference to string list 7
comes from, as I cannot find the list being used within the program at all.
From the looks of it though, you should be able to change the string list 7
to a 1.
_________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Oct 30, 2005 10:27 pm Post subject: |
|
|
Mac once made a Notepad example which could search within an editbox by using the @sendmsg function, if you can find that and just send a keystroke to the edit control once some text is selected, you should be able to create your own Notepad-like search and replace...
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Serge Professional Member


Joined: 04 Mar 2002 Posts: 1480 Location: Australia
|
|
| Back to top |
|
 |
|