Code: Select all
MyMsgBox(4, "Add or Delete", "Choose a button:", "&Add|Delete")
IfMsgBox, YES
MsgBox, You chose Add.
else
MsgBox, You chose Delete.
ChangeMyMsgBoxButtonNames(obj)
{
IfWinNotExist, % obj.MyButtonTitle
return ; Keep waiting.
SetTimer, %obj% , off ;<<---- Somewhere here is the problem....
WinActivate
Loop, % obj.MyButtonText0
ControlSetText, Button%a_index%, % obj.MyButtonText[a_index]
}
MyMsgBox(options="", Title="", Text="", ButtonNames="", timeout="")
{
;global ; make vars global
MyOptions := options
MyButtonText := []
StringSplit MyButtonText, ButtonNames, |
MyButtonTitle := title
payload:={}
payload.MyButtonTitle := MyButtonTitle
payload.MyOptions := MyOptions
payload.MyButtonText0 := MyButtonText0
Loop, % MyButtonText0
payload.MyButtonText[a_index] := MyButtonText%A_index%
fn := Func("ChangeMyMsgBoxButtonNames").bind(payload)
SetTimer, %fn%, 1
MsgBox, % options,% Title,% Text,% Timeout
}