Implementing tooltips in OSR

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Implementing tooltips in OSR

Postby crayze » Thu Feb 01, 2018 5:22 am

Hi, I have application with CEF3 (ver=3.3163.1666.g052c2d2 / chromium=61.0.3163.91) implementation in OSR mode.
I would like to display Tooltips, but CefDisplayHandler::OnTooltip is never called. I know that in native window mode it is normal, but as I know in OSR this callback should work :(

My "mouse move" events works fine, I corectly setup CefMouseEvent and when I move mouse I can see correct CSS actions on loaded pages but CefDisplayHandler::OnTooltip() never fires.
I expected to fire CefDisplayHandler::OnTooltip() when I stops mouse cursor above HTML element, which in Chrome displays tooltip, maybe I am wrong?

I didn't implemented passing "focus" events, but I can see in Chrome focus have no matter for tooltips displaying, I guess in CEF too?

Is there any way for implement tooltips in OSR?
crayze
Techie
 
Posts: 12
Joined: Wed Jun 07, 2017 9:21 am

Re: Implementing tooltips in OSR

Postby Czarek » Thu Feb 01, 2018 5:48 am

Does the issue reproduce in cefclient sample application? (run cefclient --off-screen-rendering-enabled)
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Implementing tooltips in OSR

Postby crayze » Thu Feb 01, 2018 9:10 am

Czarek wrote:Does the issue reproduce in cefclient sample application? (run cefclient --off-screen-rendering-enabled)

ok, I tested cefclient in both native window and OSR modes and in both tooltips aren't display. It seems tooltips in CEF does not work at all.
To test I go 'https://wykop.pl', and big blue links are anchor html elements with 'tittle' attribute and Chrome displays title value as tooltip- CEF none.

I'm using windows 7 if it does matter and I don't have newest version(I updated CEF in my app in summer to newest) so it would be good if someome else could test tooltips in current newest version, but probably it would be the same.
crayze
Techie
 
Posts: 12
Joined: Wed Jun 07, 2017 9:21 am

Re: Implementing tooltips in OSR

Postby Czarek » Thu Feb 01, 2018 9:55 am

In branch 3282 on Linux I can see tooltips, but they are incorrectly positioned (cefsimple windowed rendering). See screenshot:

wykop-tooltips.png
cefsimple branch 3282 Linux
wykop-tooltips.png (416.76 KiB) Viewed 5667 times


If it's reproducible in cefclient then you should create an issue in the tracker. But before doing so test with supported branches 3282/3239. Test this as well: https://www.w3schools.com/tags/att_title.asp
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: Implementing tooltips in OSR

Postby salvadordf » Thu Feb 01, 2018 10:15 am

I could test the tooltips in CEF4Delphi which uses CEF 3.3239.1723.g071d1c1 and the windowed version (MiniBrowser demo) shows the tooltips correctly.

The OSR demo also shows the tooltips when you implement the OnToolTip event.

These are the comments for the on_tooltip function at /include/capi/cef_display_handler_capi.h
Code: Select all
  ///
  // Called when the browser is about to display a tooltip. |text| contains the
  // text that will be displayed in the tooltip. To handle the display of the
  // tooltip yourself return true (1). Otherwise, you can optionally modify
  // |text| and then return false (0) to allow the browser to display the
  // tooltip. When window rendering is disabled the application is responsible
  // for drawing tooltips and the return value is ignored.
  ///


In OSR mode the application is responsible for drawing the tooltips.
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects.
User avatar
salvadordf
Expert
 
Posts: 129
Joined: Sun Dec 18, 2016 8:39 am
Location: Spain

Re: Implementing tooltips in OSR

Postby crayze » Thu Feb 01, 2018 12:02 pm

salvadordf wrote:I could test the tooltips in CEF4Delphi which uses CEF 3.3239.1723.g071d1c1 and the windowed version (MiniBrowser demo) shows the tooltips correctly.

The OSR demo also shows the tooltips when you implement the OnToolTip event.

If so I must update CEF version in my app.

salvadordf wrote:In OSR mode the application is responsible for drawing the tooltips.

Yes and I wrote the code that displays tooltip window relative to last known xy coords from mousemove event, since OnTooltip() not contains any position...
But in my case because event is never called so it not works anyway...

Anyway thanks.


EDIT(1 day after): well, I just forgot to add:
Code: Select all
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() override { return this; }

in my code... <evil>
virtual bool OnTooltip(CefRefPtr<CefBrowser> browser, CefString& text) override;
work like a charm :)

But then it's still strange that yesterday it didn't work in cefclient, cuz in my app now it working fine without any update...
crayze
Techie
 
Posts: 12
Joined: Wed Jun 07, 2017 9:21 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 69 guests