Will the gui be unresponsive if you use the WebView2 control in the tab and tab3 controls?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Will the gui be unresponsive if you use the WebView2 control in the tab and tab3 controls?

Post by thqby » 18 Oct 2021, 01:14

Code: Select all

#Include <WebView2\WebView2>

main := Gui("+Resize"), main.MarginX := main.MarginY := 0
main.OnEvent("Close", _exit_)
{
ctl := main.AddText('x0 y25 w' (A_ScreenWidth * 0.6) ' h' (A_ScreenHeight * 0.6))
}
{
; tab := main.AddTab3(Format("w{} h{}", A_ScreenWidth * 0.6, A_ScreenHeight * 0.6), ['tab1'])
; tab.UseTab(1)
; ctl := main.AddText('x0 y25 w' (A_ScreenWidth * 0.6) ' h' (A_ScreenHeight * 0.6))
; tab.UseTab()
}
main.Show(Format("w{} h{}", A_ScreenWidth * 0.6, A_ScreenHeight * 0.6))
wvc := WebView2.create(ctl.Hwnd)
wv := wvc.CoreWebView2
wv.NewWindowRequested(NewWindowRequestedHandler)
wv.Navigate('https://autohotkey.com')

NewWindowRequestedHandler(handler, wv2, arg) {
	argp := WebView2.NewWindowRequestedEventArgs(arg)
	deferral := argp.GetDeferral()
	argp.NewWindow := wv2
	deferral.Complete()
}

_exit_(*) {
	ExitApp()
}
webview2 lib

User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: Will the gui be unresponsive if you use the WebView2 control in the tab and tab3 controls?

Post by kczx3 » 18 Oct 2021, 14:16

I thought maybe it had to do with this:
Parent window: The parent window of a control affects the positioning and visibility of the control and tab-key navigation order. If a sub-control is added to an existing Tab3 control, its parent window is the "tab dialog", which fills the tab control's display area. Most other controls, including sub-controls of Tab or Tab2 controls, have no parent other than the GUI window itself.
Source
But I don't think that Tab has the same "dialog" that owns the sub-controls like Tab3 does.

User avatar
kczx3
Posts: 1640
Joined: 06 Oct 2015, 21:39

Re: Will the gui be unresponsive if you use the WebView2 control in the tab and tab3 controls?

Post by kczx3 » 18 Oct 2021, 14:19

This might play a part as well (for Tab3):
Documentation wrote: Notification messages (Tab3): Common and Custom controls typically send notification messages to their parent window. Any WM_COMMAND, WM_NOTIFY, WM_VSCROLL, WM_HSCROLL or WM_CTLCOLOR' messages received by a Tab3 control's tab dialog are forwarded to the GUI window and can be detected by using OnMessage. If the tab control is themed and the sub-control lacks the +BackgroundTrans option, WM_CTLCOLORSTATIC is fully handled by the tab dialog and not forwarded. Other notification messages (such as custom messages) are not supported.
Source

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: Will the gui be unresponsive if you use the WebView2 control in the tab and tab3 controls?

Post by thqby » 19 Oct 2021, 06:51

After testing, webview2 in TAB2 can be used normally, but neither tab nor tab3 can work.

Post Reply

Return to “Ask for Help (v2)”