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

Just starting out? Need help? Post your questions and find answers here.
Axolotl
Addict
Addict
Posts: 872
Joined: Wed Dec 31, 2008 3:36 pm

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

Post 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
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
dige
Addict
Addict
Posts: 1416
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

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

Post 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

"Daddy, I'll run faster, then it is not so far..."
Axolotl
Addict
Addict
Posts: 872
Joined: Wed Dec 31, 2008 3:36 pm

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

Post 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 
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
dige
Addict
Addict
Posts: 1416
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

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

Post 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!
"Daddy, I'll run faster, then it is not so far..."
Post Reply