Find and replace in selected text only

In Real Studio, I was able to replace strings in selected text only, but now, I’m tring to find a way to do this in XOJO but I did not find a solution.

I can search and replace in the whole project, in a the items and subclasses and in the current object or function. There is no option for “Selected text” or highlight text…

I really need this for repetitive tasks, so I have to go in an external application using copy-paste, then search and replace and finally copy-paste in my XOJO project, this is absolutely not convenient…

Is there any solution in XOJO ?

What I do is select the text, copy and paste it into notepad. You could whatever text editor your OS has. Use search and replace. In Notepad the shortcut key is ctrl+h, you should be able to work it out from there.

Hope this helps. :slight_smile:

[quote=32386:@SbastienAngot]In Real Studio, I was able to replace strings in selected text only, but now, I’m tring to find a way to do this in XOJO but I did not find a solution.

I can search and replace in the whole project, in a the items and subclasses and in the current object or function. There is no option for “Selected text” or highlight text…

I really need this for repetitive tasks, so I have to go in an external application using copy-paste, then search and replace and finally copy-paste in my XOJO project, this is absolutely not convenient…

Is there any solution in XOJO ?[/quote]
Ha…sorry i did not read it all.

[quote=32386:@SbastienAngot]In Real Studio, I was able to replace strings in selected text only, but now, I’m tring to find a way to do this in XOJO but I did not find a solution.

I can search and replace in the whole project, in a the items and subclasses and in the current object or function. There is no option for “Selected text” or highlight text…

I really need this for repetitive tasks, so I have to go in an external application using copy-paste, then search and replace and finally copy-paste in my XOJO project, this is absolutely not convenient…

Is there any solution in XOJO ?[/quote]
I have asked the same question to myself before. :wink:

[quote=32386:@SbastienAngot]In Real Studio, I was able to replace strings in selected text only, but now, I’m tring to find a way to do this in XOJO but I did not find a solution.

I can search and replace in the whole project, in a the items and subclasses and in the current object or function. There is no option for “Selected text” or highlight text…

I really need this for repetitive tasks, so I have to go in an external application using copy-paste, then search and replace and finally copy-paste in my XOJO project, this is absolutely not convenient…

Is there any solution in XOJO ?[/quote]
There appears to be no way of doing this from any of the search options so I am presuming that this is not possible in Xojo. I have never worked with XojoScript before but do you think that you could use that and write an IDE script that does this. Apologies for my lack of knowledge and hope this works well until this feature gets implemented into Xojo. Never tried this before either but this tool might help you. :wink: http://www.omegabundle.com/arbed-for-xojo-2013

Thanks for your answer but, I think the best way would be XOJO put this function back in the application… I use it so often and I think I am not the only one :slight_smile:

In fact, I don’t understand why this function is nomore in XOJO… What a weird idea to remove it!

It was most likely an oversight. Add your support to the feedback case. <https://xojo.com/issue/27328>

You can easily create an IDE script like this

if selLength > 0 then selText = selText.replaceAll("search", "replace") end if

and just replace the strings with your search and replace text. Unfortunately, I don’t think IDE scripts can throw up a dialog to ask you for information; at least I haven’t ever tried that.

FWIW, Arbed can also do Find & Replace through scripting, and Arbed’s scripting is a bit more powerful in this regard that Xojo’s own IDE scripting. A few example scripts for find & replace are included with the download. I recently used such a script to remove unused Events for “Maximize” and “Restore” in ContainerControls that Xojo r3 complains about.

Downside of Arbed is that you’d need to buy a license for it, though ($59 for unlimited time, though I’m thinking about a 1-year license for around $20 to $25 now). Also, it doesn’t have an interactive Find&Replace yet (only Find).

Though, this doesn’t help Sbastien now. My only advice to Sbastien is: Use the old IDE. RB 2012r2.1 is still pretty usable for that, and you can still switch between it and Xojo without significant data loss as far as I can tell.

I just got burnt by this issue tonight! Sigh, hope it comes back soon. I just needed to replace about 30 items in a block (but not the other 60 odd).

Even though I could replace each item, each time I selected the item in FInd, I would get the form displayed, then when I clicked Replace 1 iitem, the Find would scroll back to the top. Painful!

Same for me, it would be great to be able just to replace in selection.