[v2] ActiveX ComObjConnect example Topic is solved

Share your ideas as to how the documentation can be improved.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

[v2] ActiveX ComObjConnect example

24 Sep 2021, 17:29

https://lexikos.github.io/v2/docs/commands/GuiControls.htm#ActiveX
this(current) v2 code doesnt work:

Code: Select all

MyGui := Gui()
URL := MyGui.Add("Edit", "w930 r1", "https://www.autohotkey.com/boards/")
MyGui.Add("Button", "x+6 yp w44 Default", "Go").OnEvent("Click", ButtonGo)
WB := MyGui.Add("ActiveX", "xm w980 h640", "Shell.Explorer").Value
ComObjConnect(WB, WB_events)  ; Connect WB's events to the WB_events class object.
MyGui.Show()
; Continue on to load the initial page:
ButtonGo()

ButtonGo(*) {
    WB.Navigate(URL.Value)
}

class WB_events {
    NavigateComplete2(wb, NewURL) {
        URL.Value := NewURL  ; Update the URL edit control.
    }
}

this one does:

Code: Select all

MyGui := Gui()
URL := MyGui.Add("Edit", "w930 r1", "https://www.autohotkey.com/boards/")
MyGui.Add("Button", "x+6 yp w44 Default", "Go").OnEvent("Click", ButtonGo)
WB := MyGui.Add("ActiveX", "xm w980 h640", "Shell.Explorer").Value
ComObjConnect(WB, WB_events)  ; Connect WB's events to the WB_events class object.
MyGui.Show()
; Continue on to load the initial page:
ButtonGo()

ButtonGo(*) {
    WB.Navigate(URL.Value)
}

class WB_events {
    static NavigateComplete2(wb, &NewURL, OriginalComObj) {
        URL.Value := NewURL  ; Update the URL edit control.
    }
}
User avatar
Ragnar
Posts: 613
Joined: 30 Sep 2013, 15:25

Re: [v2] ActiveX ComObjConnect example  Topic is solved

26 Sep 2021, 07:24

Thanks for reporting. Change added in PR #492.

Return to “Suggestions on Documentation Improvements”

Who is online

Users browsing this forum: No registered users and 5 guests