-
Notifications
You must be signed in to change notification settings - Fork 15
/
VarTree_test.ahk
59 lines (51 loc) · 1.28 KB
/
VarTree_test.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
TODO:
show a separate dialog for editing really large (or multi-line) values
consider how to display `n and other such characters
*/
#Warn , StdOut
A_Args := [["line1`nline2","B"],["C",["D"],"E"]]
test_vars := "
(LTrim
A_ScriptDir
A_ScriptName
A_ScriptFullPath
A_ScriptHwnd
A_Args
)"
test_obj := {}
Loop Parse test_vars, "`n"
test_obj.%A_LoopField% := %A_LoopField%
ShowGuiForObject(test_obj)
ShowGuiForObject(obj) {
vtg := VarTreeGui(VarTreeObjectNode(obj))
vtg.OnContextMenu := ContextMenu
vtg.OnDoubleClick := EditNode
vtg.Show()
}
ContextMenu(vtg, node, isRightClick, x, y) {
m := Menu()
m.Add("Inspect", (*) => EditNode(vtg, node))
m.Show(x, y)
}
EditNode(vtg, node) {
if IsObject(node.value) {
ShowGuiForObject(node.value)
}
else {
veg := VarEditGui({name: node.values[1], value: node.value, type: type(node.value)})
veg.OnSave := ED_Save.Bind(vtg, node)
veg.Show()
}
}
ED_Save(vtg, node, ed, value, type) {
node.SetValue(%type%(value))
vtg.TLV.EnableRedraw(false)
vtg.TLV.Reset()
vtg.TLV.EnableRedraw(true)
ed.Var.value := value
ed.Var.type := type
}
#Include VarTreeGui.ahk
#Include VarTreeObjectNode.ahk
#Include VarEditGui.ahk