Page 1 of 1

PB 6.20 beta 2 (x64) Issue with invisible WebViewGadget()

Posted: Thu Jan 16, 2025 5:46 pm
by Axolotl
I guess that an invisible WebViewGadget() does not work!

BTW: We had a similar issue with the WebGadget()
[Done] PB 6.10 beta 1 Error with invisible window and Webgadet

Some code to test:

Code: Select all

 
Global local_url$ = "file://" + "C:\Temp\Intelligenz.pdf"    ; <<< change this to your own file. 

If OpenWindow(0, 0, 0, 600, 600, "#1 WebGadget <working>", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible)
  HideWindow(0, 0)                    ; <-- because of this line at this location it works 
  WebViewGadget(0, 10, 10, 580, 580) 
  SetGadgetText(0, local_url$) 
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf

; --- 

If OpenWindow(0, 0, 0, 600, 600, "#2 WebGadget <not working>", #PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_Invisible)
  WebViewGadget(0, 10, 10, 580, 580)  ; <-- invisible WebViewGadget() does not work! 
  HideWindow(0, 0) 
  SetGadgetText(0, local_url$) 
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf

; --- 

If OpenWindow(0, 0, 0, 600, 600, "#3 WebGadget <working>", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 
  WebViewGadget(0, 10, 10, 580, 580) 
  SetGadgetText(0, local_url$) 
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf

Re: PB 6.20 beta 2 (x64) Issue with invisible WebViewGadget()

Posted: Fri Jan 17, 2025 10:32 am
by dige
I can confirm this (Windows 10, PB 6.20 B2 x86)

I had the same problem - now I understand the connection, thank you very much!

I am now using the following workaround for the time being:

Code: Select all

Global local_url$ = "file://" + "C:\Temp\qr-code.svg"    ; <<< change this to your own file. 

If OpenWindow(0, -600, 0, 600, 600, "#1 WebGadget <working>", #PB_Window_SystemMenu)
  WebViewGadget(0, 10, 10, 580, 580) 
  SetGadgetText(0, local_url$) 
  Delay(100)
  
  ExamineDesktops()
  ResizeWindow(0, DesktopWidth(0)/2 - WindowWidth(0)/2, DesktopHeight(0)/2 - WindowHeight(0)/2, #PB_Ignore, #PB_Ignore)
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
EndIf


Re: PB 6.20 beta 2 (x64) Issue with invisible WebViewGadget()

Posted: Fri Jan 17, 2025 12:16 pm
by Axolotl
Thanks dige.

BTW: I help myself with this little HideWindow() replacement for the WebViewGadget() - Window.
And yet the gadget flashes (black) before the file is displayed.
P.S.. I know, leading zeros are superfluous, as in .......

Code: Select all

Procedure HideWindowFast(Window, State) 
  Protected y, OutsideScreenY = $00004000 ; very large value, one bit only -- the biggest value that PB can handle 

  If IsWindow(Window) 
    y = WindowY(Window) 
    If State : y | OutsideScreenY     ; move window outside the visible screen area 
    Else     : y & ~OutsideScreenY    ; move window inside (normal position) 
    EndIf 
    ResizeWindow(Window, #PB_Ignore, Y, #PB_Ignore, #PB_Ignore) 
  EndIf 
EndProcedure 

Re: PB 6.20 beta 2 (x64) Issue with invisible WebViewGadget()

Posted: Fri Jan 17, 2025 1:17 pm
by dige
Thanks for the tip. That's a pretty clever solution. With the highest possible value you also avoid the problem of it ending up on another monitor - cool!