Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

Enabled find ?

Post Reply
thefunkyjoint
Posts: 459
Joined: Thu Aug 10, 2017 12:40 pm

Enabled find ?

Post 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.
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Enabled find ?

Post 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.
thefunkyjoint
Posts: 459
Joined: Thu Aug 10, 2017 12:40 pm

Re: Enabled find ?

Post by thefunkyjoint »

That's great, thank you !
kynesser
Posts: 1
Joined: Mon Jul 13, 2020 7:12 pm

Re: Enabled find ?

Post 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.
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Enabled find ?

Post 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
Post Reply