我已经开发了我的 ListBox(附加屏幕截图)。
列为:
询问回调
OptOut_取消订阅
OptOut_Callback
争议回调
其他_其他
查询回调
S_OptOut_取消订阅
回调函数
争议回调
其他 其他
查询回调
退出回调
争议回调
电子邮件退出 IVR
电子邮件退出IVR
电子邮件退出_IVR_N
我有 29 个客户,可以属于上述任一类别,这意味着其有 16 x 29 = 464 个模板。
我的问题是,我如何修改列表框,以便当我将光标放在任何项目上时(使用向上/向下箭头),右侧会出现一个新的滑动列表框,用于该特定项目,并列出所有 29 位客户。就像 word/excel 中的一样,当您单击“文件菜单”时,会出现一个子菜单,然后对于滑动菜单中的每个项目,都会出现带有其自己的项目的二级菜单。
这是我的列表框的代码:
Gui, Add, ListBox, gAction vChoise w190 h440 c66ff00, Inquiry_Callback|OptOut_UnSub|OptOut_Callback|Dispute_Callback|Others_Others|-|S_Inquiry_Callback|S_OptOut_Unsub|S_OptOut_Callback|S_Dispute_Callback|S_Others_Others|-|S_Inquiry_Callback_N|S_OptOut_Callback_N|S_Dispute_Callback_N|-|Email_OptOut_IVR|-|S_Email_OptOut_IVR|S_Email_OptOut_IVR_2|-|dummy
return
^F1:: Gui, Show, x400 y180, Actions
Action:
If ((A_GuiEvent = "DoubleClick") || (Trigger_Action))
Gui, Submit
{
If (Choise = "Inquiry_Callback")
{
do this, do that
}
If (Choise = "OptOut_UnSub")
{
do this, do that
}
If (Choise = "OptOut_Callback")
{
do this, do that
}
If (Choise = "Dispute_Callback")
{
do this, do that
}
If (Choise = "Others_Others")
{
do this, do that
}
If (Choise = "S_Inquiry_Callback")
{
do this, do that
}
If (Choise = "S_OptOut_Unsub")
{
do this, do that
}
If (Choise = "S_OptOut_Callback")
{
do this, do that
}
If (Choise = "S_Dispute_Callback")
{
do this, do that
}
and so on...
If (Choise = "dummy")
MsgBox, Reserved for Additional Customer
}
return
#If WinActive("Actions ahk_class AutoHotkeyGUI")
Enter::
Trigger_Action := true
GoSub, Action
Trigger_Action := false
return
#If
GuiEscape:
Gui, cancel
GuiClose:
Gui, cancel
Return
希望你明白我的意思。
答案1
尝试这样的操作:
#NoEnv
#SingleInstance Force
DetectHiddenWindows, On
SetTitleMatchMode, 2
Gui, Add, ListBox, gAction vChoise w190 h440 c66ff00, Inquiry_Callback||OptOut_UnSub|OptOut_Callback|dummy
return
^F1:: Gui, Show, x400 y180, Actions
Action:
If ((A_GuiEvent = "DoubleClick") || (Trigger_Action))
{
WinClose, _Actions.ahk - AutoHotkey v ahk_class AutoHotkey
Gui, Submit, NoHide
If (Choise = "dummy")
MsgBox, Reserved for Additional Customer
else
{
IfNotExist, %A_ScriptDir%\%Choise%_Actions.ahk
GoSub, Create_Choise_Script
Run, %A_ScriptDir%\%Choise%_Actions.ahk
}
}
return
Create_Choise_Script:
FileAppend,
(
#NoEnv
#SingleInstance Force
; Gui, -Caption
Gui, Add, ListBox, gCustomerAction vChoise w500 h50, customer1||customer2|customer3
WinGetPos, X, Y, Width,, Actions ahk_class AutoHotkeyGUI
Xn := (X+Width)
Gui, Show, x`%Xn`% y`%Y`%, %Choise%_Actions
return
CustomerAction:
If ((A_GuiEvent = "DoubleClick") || (Trigger_CustomerAction))
{
WinClose, Actions ahk_class AutoHotkeyGUI ; after pressing the final choice (the Customer), the ListBox will CLOSE
Gui, Submit
If (Choise = "customer1")
MsgBox, customer1
If (Choise = "customer2")
MsgBox, customer2
If (Choise = "customer3")
MsgBox, customer3
ExitApp
}
return
#If WinActive("%Choise%_Actions ahk_class AutoHotkeyGUI")
Enter::
Trigger_CustomerAction := true
GoSub, CustomerAction
Trigger_CustomerAction := false
return
Left:: ; go back
WinActivate, Actions ahk_class AutoHotkeyGUI
ExitApp
return
#If
GuiEscape:
GuiClose:
ExitApp
), %A_ScriptDir%\%Choise%_Actions.ahk
Return
#If WinActive("Actions ahk_class AutoHotkeyGUI")
Enter::
Right::
Trigger_Action := true
GoSub, Action
Trigger_Action := false
return
#If
GuiEscape:
GuiClose:
Gui, cancel
Return