Page 1 of 1
WebViewGadget inside frame freezes window
Posted: Sun Feb 25, 2024 11:11 pm
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
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Mon Feb 26, 2024 11:04 am
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
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Mon Feb 26, 2024 12:35 pm
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
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Mon Feb 26, 2024 1:19 pm
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
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Mon Feb 26, 2024 8:27 pm
by Dreamland Fantasy
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
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Mon Feb 26, 2024 10:03 pm
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
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Tue Feb 27, 2024 12:16 am
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!
Kind regards,
Francis
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Sat Mar 02, 2024 10:36 am
by Fred
Fixed. I will leave it in Windows forum as it contains useful info.
Re: [PB 6.10 beta 6] WebViewGadget inside frame freezes window
Posted: Sat Mar 02, 2024 10:39 am
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!
Kind regards,
Francis