TreeView AHK1 to AHK 2

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
dentopolis
Posts: 125
Joined: 06 May 2016, 16:28

TreeView AHK1 to AHK 2

19 Oct 2021, 06:00

How can I modify this AHK 1 code to AHK 2 to specify it's width, height, set always on top and add action if item is clicked?

this part works fine in AHK 2:

Code: Select all

MyGui := Gui()
TV := MyGui.Add("TreeView")
P1 := TV.Add("test1")
	P1C1 := TV.Add("something", P1)
	
P2 := TV.Add("test2")
	P2C1 := TV.Add("something", P2)

MyGui.Show
and this part worked in AHK 1:

Code: Select all


TV.Modify(P1, "Expand")
TV.Modify(P2, "Expand")

Gui +HwndGuiHwnd +AlwaysOnTop +LastFound
Gui Add, TreeView, gTreeViewEvent x5 y5 w400 h300
DetectHiddenWindows, On
WinSet, TransColor, EEAA99 50
DetectHiddenWindows, Off


TreeViewEvent:
	if (A_GuiEvent = "DoubleClick") {
		TV_GetText(ItemText, A_EventInfo)
		clipboard := % ItemText
		WinActivate, ahk_exe soffice.bin
		Sleep, 500
		SendInput, % ItemText
		SendInput, {enter}
		Sleep, 500
		WinActivate, Shortcuts
	}
return
User avatar
thqby
Posts: 406
Joined: 16 Apr 2021, 11:18
Contact:

Re: TreeView AHK1 to AHK 2

19 Oct 2021, 06:43

mygui := Gui('AlwaysOnTop')
TV.OnEvent(eventname, callback) creates event callback.
see https://lexikos.github.io/v2/docs/objects/GuiOnEvent.htm

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: No registered users and 43 guests