Page 1 of 1

Tooltips in zoomed display

Posted: Tue Sep 03, 2024 7:55 am
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?

Re: Tooltips in zoomed display

Posted: Wed Sep 04, 2024 10:26 am
by Peter
Code?

Re: Tooltips in zoomed display

Posted: Thu Sep 05, 2024 6:24 am
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
  

Re: Tooltips in zoomed display

Posted: Fri Sep 06, 2024 12:29 am
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

Re: Tooltips in zoomed display

Posted: Fri Sep 27, 2024 6:30 pm
by Stefan
Thank you :)