Page 1 of 1

Enabled find ?

Posted: Mon Aug 26, 2019 7:12 pm
by thefunkyjoint
Hi,

Is there a way to enable the Find option in TChromium ? Is the feature Chrome has when you hit Ctrl+F, it shows a dialog to type a search term to be find in the current url.

Re: Enabled find ?

Posted: Mon Aug 26, 2019 7:40 pm
by salvadordf
HI,

CEF doesn't include a search box or any other user interface to search for text. However, TChromium has 2 procedures to let the user find text in a web page :
  • TChromium.Find
  • TChromium.StopFinding
These are the code comments for the "Find" procedure :

Code: Select all

  ///
  // Search for |searchText|. |identifier| must be a unique ID and these IDs
  // must strictly increase so that newer requests always have greater IDs than
  // older requests. If |identifier| is zero or less than the previous ID value
  // then it will be automatically assigned a new valid ID. |forward| indicates
  // whether to search forward or backward within the page. |matchCase|
  // indicates whether the search should be case-sensitive. |findNext| indicates
  // whether this is the first request or a follow-up. The cef_find_handler_t
  // instance, if any, returned via cef_client_t::GetFindHandler will be called
  // to report find results.
  ///
And these are the comments for "StopFinding" :

Code: Select all

  ///
  // Cancel all searches that are currently going on.
  ///
You can add a TEdit to your app to search for any text and call those functions to highlight the findings.

Re: Enabled find ?

Posted: Tue Aug 27, 2019 10:59 am
by thefunkyjoint
That's great, thank you !

Re: Enabled find ?

Posted: Mon Oct 05, 2020 5:44 pm
by kynesser
Boa tarde,

Gostaria de saber se tem com verificar via código se o sistema encontrou resultado.
Pergunto porque visualmente ele marca o texto encontrado, mas a busca não retorna uma resposta de verdadeiro ou falso.

Obrigado.

Re: Enabled find ?

Posted: Tue Oct 06, 2020 7:35 am
by salvadordf
Hi,

Use the TChromium.OnFindResult event to know more details about the search results.

Read this for all the details about that event :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html