WebViewGadget inside frame freezes window

Windows specific forum
User avatar
Dreamland Fantasy
Enthusiast
Enthusiast
Posts: 335
Joined: Fri Jun 11, 2004 9:35 pm
Location: Glasgow, UK
Contact:

WebViewGadget inside frame freezes window

Post by Dreamland Fantasy »

Hi there,

I've only recently downloaded the 6.10 beta and I've been taking it for a spin with a current project. I've noticed that there seems to be a bug when using the WebViewGadget within a frame as it seems to cause the window to become completely unresponsive. I can't even drag the window about with the mouse pointer.

Here is some example code to illustrate:

Code: Select all

OpenWindow(0, 100, 100, 400, 400, "Hello", #PB_Window_SystemMenu | #PB_Window_Invisible)

FrameGadget(0, 0, 0, 400, 400, "WebView Gadget")
WebViewGadget(1, 25, 25, 350, 350)

HideWindow(0, #False)

Repeat 
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
The program works as expected if the FrameGadget() is commented out.

This is on Windows 11. I'm testing the 32-bit version of PureBasic 6.10 beta 6. I haven't tried it on the 64-bit version.

Kind regards,

Francis
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Justin »

It's a known issue, i don't think it's a pb bug;
https://stackoverflow.com/questions/336 ... ssage-loop
The solution is to put the frame on top of the webview:

Code: Select all

OpenWindow(0, 100, 100, 400, 400, "Hello", #PB_Window_SystemMenu | #PB_Window_Invisible | #PB_Window_MinimizeGadget)
WebViewGadget(1, 25, 25, 350, 350)
FrameGadget(0, 0, 0, 400, 400, "WebView Gadget")

HideWindow(0, #False)

Repeat 
  ev = WaitWindowEvent()
Until ev = #PB_Event_CloseWindow
User avatar
Dreamland Fantasy
Enthusiast
Enthusiast
Posts: 335
Joined: Fri Jun 11, 2004 9:35 pm
Location: Glasgow, UK
Contact:

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Dreamland Fantasy »

Ah, I see.

The issue is I'm using it as part of a Dialog structure, so I would need the frame to be defined first before the WebViewGadget.

I'll just need to revert back to using the WebGadget.

Kind regards,

Francis
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Justin »

You can use SetWindowPos_() to change the z order to put the frame on top once the dialog is created.
https://learn.microsoft.com/en-us/windo ... twindowpos
User avatar
Dreamland Fantasy
Enthusiast
Enthusiast
Posts: 335
Joined: Fri Jun 11, 2004 9:35 pm
Location: Glasgow, UK
Contact:

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Dreamland Fantasy »

Justin wrote: Mon Feb 26, 2024 1:19 pm You can use SetWindowPos_() to change the z order to put the frame on top once the dialog is created.
https://learn.microsoft.com/en-us/windo ... twindowpos
Thanks. I got it working using this:

Code: Select all

UseDialogWebViewGadget()

XML_MainWindow$ = "<window id='0' name='Test' minwidth='640' minheight='480' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_Invisible'>" +
                  "    <frame text = 'Frame'>'" +
                  "      <webview id = '0'/>" +
                  "    </frame>" +
                  "</window>"

If CatchXML(0, @XML_MainWindow$, StringByteLength(XML_MainWindow$)) And XMLStatus(0) <> #PB_XML_Success
  Debug "XML error: " + XMLError(0) + " (Line: " + XMLErrorLine(0) + ")"
EndIf

If CreateDialog(0) And OpenXMLDialog(0, 0, "Test", 0, 0, 0, 0) = 0
  Debug "Dialog error: " + DialogError(0)
EndIf

SetWindowPos_(GadgetID(0), #HWND_TOP, 0, 0, 0, 0, 0)

HideWindow(0, 0)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
It seems I had to put the WebView gadget on top though. Putting the frame on top didn't seem to make a difference.

Kind regards,

Francis
Justin
Addict
Addict
Posts: 832
Joined: Sat Apr 26, 2003 2:49 pm

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Justin »

For me it makes more sense like this:

Code: Select all

UseDialogWebViewGadget()

XML_MainWindow$ = "<window id='0' name='Test' minwidth='640' minheight='480' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_Invisible'>" +
                  "    <frame id='1' text = 'Frame'>'" +
                  "      <webview id = '0'/>" +
                  "    </frame>" +
                  "</window>"

If CatchXML(0, @XML_MainWindow$, StringByteLength(XML_MainWindow$)) And XMLStatus(0) <> #PB_XML_Success
  Debug "XML error: " + XMLError(0) + " (Line: " + XMLErrorLine(0) + ")"
EndIf

If CreateDialog(0) And OpenXMLDialog(0, 0, "Test", 0, 0, 0, 0) = 0
  Debug "Dialog error: " + DialogError(0)
EndIf

SetWindowPos_(GadgetID(1), GadgetID(0), 0, 0, 0, 0, #SWP_NOMOVE | #SWP_NOSIZE)

HideWindow(0, 0)

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
User avatar
Dreamland Fantasy
Enthusiast
Enthusiast
Posts: 335
Joined: Fri Jun 11, 2004 9:35 pm
Location: Glasgow, UK
Contact:

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Dreamland Fantasy »

Justin wrote: Mon Feb 26, 2024 10:03 pm For me it makes more sense like this:
Yes, that certainly makes more sense. Thank you! :D

Kind regards,

Francis
Fred
Administrator
Administrator
Posts: 16687
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Fred »

Fixed. I will leave it in Windows forum as it contains useful info.
User avatar
Dreamland Fantasy
Enthusiast
Enthusiast
Posts: 335
Joined: Fri Jun 11, 2004 9:35 pm
Location: Glasgow, UK
Contact:

Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window

Post by Dreamland Fantasy »

Fred wrote: Sat Mar 02, 2024 10:36 am Fixed. I will leave it in Windows forum as it contains useful info.
Thanks Fred! :D

Kind regards,

Francis
Post Reply