Message boxes
by Drew -Gaiiden- Sikora · in Torque Game Builder · 12/19/2005 (8:43 am) · 3 replies
Is there a similar method in ts for calling a message box the way you can in win32 so that you can get a return value and proceed from there? like
%response = showMsgBox(%msg, %mode); if(%response) ...Obviously i don't expect there to actually be a showMsgBox function, I'm just looking for a way to accomplish this.
#2
12/19/2005 (1:59 pm)
Check out your example/common/client/messageBox.cs file... There are some message boxes already there, like OK / Cancel, OK, Yes / No, Pop up, etc. You can't quite do it how you have in your example code, though you can specify a callback in them so you can accomplish the same results. Heres an example pulled from the script file.function MessageBoxYesNo( %title, %message, %yesCallback, %noCallback )
{
MBYesNoFrame.setText( %title );
Canvas.pushDialog( MessageBoxYesNoDlg );
MBSetText(MBYesNoText, MBYesNoFrame, %message);
MessageBoxYesNoDlg.yesCallBack = %yesCallback;
MessageBoxYesNoDlg.noCallback = %noCallBack;
}
#3
12/19/2005 (5:23 pm)
Thx for the feedback guys. Yea Matt, that's exactly how I have my msg box set up right now. The problem I've come across is a situation like this:function setMap(%size)
{
// map needs to be saved?
if ($gameData.isMapChanged)
loadMsgBoxDlg($DLG_MSG_SAVE_MAP, saveMap, $MSG_BOX_YESNO);
// load new map
}So my callback would be saveMap, which gets a true/false argument fom the dialog. The problem is I need that function's argument, %size, in order to load the new map. So my dilemma is calling the dialog box and getting the users response and then calling the proper function with the proper value for the argument. I'll figure it out, just wanted to make sure I had to before I bothered to :P
Torque Owner Jason McIntosh