Tooltips in zoomed display

Just starting out? Need help? Post your questions and find answers here.
Stefan
Posts: 248
Joined: Mon Feb 05, 2018 9:44 pm

Tooltips in zoomed display

Post by Stefan »

If the browser is zoomed, the tooltips are no longer displayed correctly.
They are somewhere on the screen. Is there any way to control/adjust this?
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Tooltips in zoomed display

Post by Peter »

Code?
Stefan
Posts: 248
Joined: Mon Feb 05, 2018 9:44 pm

Re: Tooltips in zoomed display

Post by Stefan »

Code: Select all

!document.body.style.zoom = 1.5/ window.devicePixelRatio * 100 + "%"


 If OpenWindow(0, 0, 0, 800, 600, "GadgetTooltip", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ButtonGadget(0, 1, 1, 250, 30, "Button with tooltip")
    GadgetToolTip(0, "<i>Tooltip</i> for Button") 
  EndIf
  
User avatar
Peter
Posts: 1197
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Tooltips in zoomed display

Post by Peter »

This is probably a problem with the dojo/dijit framework used. If you try to move the window, you will see that this is not the only problem.

Here is a workaround with the normal html title attribute. Not as nice as the dojo/dijit tooltip, but at least this one works:

Code: Select all

!document.body.style.zoom = 1.5/ window.devicePixelRatio * 100 + "%"

Procedure ButtonGadgetToolTip(Gadget, ToolTip.s)
  Protected GID = GadgetID(Gadget)
  ! $(v_gid.div).find(".dijitButtonText").attr("title", v_tooltip);
EndProcedure

If OpenWindow(0, 0, 0, 800, 600, "GadgetTooltip", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ButtonGadget(0, 1, 1, 250, 30, "Button with tooltip")
  ButtonGadgetToolTip(0, "Tooltip for Button") 
EndIf
Stefan
Posts: 248
Joined: Mon Feb 05, 2018 9:44 pm

Re: Tooltips in zoomed display

Post by Stefan »

Thank you :)
Post Reply