HTMLview.Search Return Something If Not Found

Discuss GUI programming with the RapaGUI plugin here
Post Reply
PEB
Posts: 597
Joined: Sun Feb 21, 2010 1:28 am

HTMLview.Search Return Something If Not Found

Post by PEB »

Is there a way to get HTMLview.Search to return something (bool or string) if the searched string is not found on the page?

In my code, I'm trying to find either one of two possible strings in the html files that I'm viewing. If the first is found, then I don't want to search for the second (and lose the first); but if the first is not found, then I do want to search for the second.
User avatar
airsoftsoftwair
Posts: 6034
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: HTMLview.Search Return Something If Not Found

Post by airsoftsoftwair »

Currently not possible, but I'll see if this can be added.
PEB
Posts: 597
Joined: Sun Feb 21, 2010 1:28 am

Re: HTMLview.Search Return Something If Not Found

Post by PEB »

Thanks!
User avatar
airsoftsoftwair
Posts: 6034
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: HTMLview.Search Return Something If Not Found

Post by airsoftsoftwair »

Code: Select all

- New: HTMLview.Search() returns a boolean now indicating whether or not the search term was actually found
PEB
Posts: 597
Joined: Sun Feb 21, 2010 1:28 am

Re: HTMLview.Search Return Something If Not Found

Post by PEB »

Thanks, Andreas.
That will be very helpful.
PEB
Posts: 597
Joined: Sun Feb 21, 2010 1:28 am

Re: HTMLview.Search Return Something If Not Found

Post by PEB »

found = moai.DoMethod(id, "Search", t$, flags$)

The result (found) seems always to report as False, even when the text has been found.
User avatar
airsoftsoftwair
Posts: 6034
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: HTMLview.Search Return Something If Not Found

Post by airsoftsoftwair »

Ok, I'll check.
PEB
Posts: 597
Joined: Sun Feb 21, 2010 1:28 am

Re: HTMLview.Search Return Something If Not Found

Post by PEB »

I should have specified that I've only tried this on Android.
PEB
Posts: 597
Joined: Sun Feb 21, 2010 1:28 am

Re: HTMLview.Search Return Something If Not Found

Post by PEB »

airsoftsoftwair wrote: ↑Sat Nov 23, 2024 12:26 am Ok, I'll check.
Were you ever able to fix this issue?
User avatar
airsoftsoftwair
Posts: 6034
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: HTMLview.Search Return Something If Not Found

Post by airsoftsoftwair »

PEB wrote: ↑Thu Nov 12, 2026 12:07 am Were you ever able to fix this issue?
I'm afraid it's unfixable. I've debugged it and the reason why it always returns FALSE on Android is that Android's WebView design changed to asynchronous searching which won't give immediate feedback on the search result. Instead it will run a callback for each search result. So the only way to support this would be to make RapaGUI support a new event callback that is called for the search results but that's probably not easily implementable for the non-Android platforms so I'm afraid you'll have to live with this behaviour for now or you could maybe use some custom code to work around it.
Post Reply