[Gambas-user] WebView - Findtext

Gianluigi bagonergi at gmail.com
Wed May 19 13:15:59 CEST 2021


Il giorno mer 19 mag 2021 alle ore 05:41 Ian Roper <ian.roper at iinet.net.au>
ha scritto:

> The qt webview component has a Findtext method.
>
> MyWebView.Findtext("text",Backward,CaseSensitive,Wrap)
>
> The first issue I am trying to resolve, is that the search function does
> not have a 'whole word' parameter.
>
> ie: if you search for '*can*' it will highlight 'va*can*t'.
>
> The second issue is that there is no way I can find to return the search
> 'start position' to the top of the page.
>
> If you are searching for a list of words in order. Apple,Banana,Pineapple.
>
> and the text is:
>
> Apple
>
> Pineapple
>
> Pineapple
>
> Banana
>
> Apple.
>
> After the first search item is complete (Apple) then a search for the
> other items in the list returns zero found.
> The search pointer is set to the final 'apple' in the list and no other
> search items from the list are found.
>
> Is there a way to start a search at the beginning of the document ?
>
> Note# MyWebView.Refresh does not do this.- Tested.
>
> Note# Setting the 'wrap' parameter in the findtext method to 'True', puts
> the search into an endless loop.
>
> Any ideas ?
>
> Cheers,
>
> Ian
>
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>

Hi,
the WebView component is complex on the Farm there is something, looking
for webbrowser...
Try this code:
---------------------------------
Public Sub ButtonBox1_Click()

  If WebView1.FindText(ButtonBox1.Text,,, False) Then
    If Message.Question("xxx?", "Yes", "No") = 1 Then
      WebView1.FindText(ButtonBox1.Text,,, True)
    Else
      ButtonBox1.Clear
      WebView1.FindText(ButtonBox1.Text,,, True)
    Endif
  Else
    WebView1.SetFocus()
  Endif

End

Public Sub Form_Open()

  WebView1.HTML = "Banana<br>Apple<br>Pineapple<br>Pineapple<br>Banana"
  ButtonBox1.Text = "apple"

End
------------------------------------

Regards
Gianluigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210519/ef9af5ef/attachment.htm>


More information about the User mailing list