View Full Version : "Yes / No / Yes to All / No to All / Cancel" query box?
erilaz 10-18-2007, 01:47 AM I'm copying a vast amount of files which all need confrmation for overwrites.
Is there a way to call a "Yes / No / Yes to All / No to All / Cancel" query box inside maxscript, or does it need to be created manually? The most extensive one I can find is "Yes No Cancel", and i'm having some difficulty finding an equivalent in dotNet, or even something that will handle the copy prompts for me.
Obviously I can create a dialog in maxscript, but if there is already a default box to do this it would be far more helpful!:)
Although dotNet forms do have a lot of MessageBox.show options, they don't have this one.
|
|
LoneRobot
10-18-2007, 09:25 AM
Hi Martin,
I did look into coding my own one for this recently as i couldn't find one either. I'm still in max 8 so dotnet was out of the question. but in the end just settled for a yes/no/cancel box and an option on the script to bypass the "does file exist" check. not perfect but im not handling the same amount of files in my script, around 10-20 each execution.
a while back i thought i'd like a different messagebox from the one max puts up and thought if it was just a rollout generated by a function, you could call it with the message string and the rollout height and include a bitmap logo of something rather than that exclamation mark. I guess you could also adapt it to pass the bitmap to the function so you could have different icons/logos for different types of message boxes - warnings, information, querys etc...
fn custommessagebox message hval =
(
rollout err "" width:300 height:82
(
bitmap bmplogo "Bitmap" pos:[6,10] width:47 height:63
label lbltext "" pos:[61,10] width:225 height:500
)
createdialog err 300 hval bgcolor:white fgcolor:black style:#(#style_toolwindow, #style_sysmenu)
err.lbltext.text = message
)
custommessagebox "blah X 10000000000000000" 100
not what you asked for i know but i thought i'd just chime in!
erilaz
10-18-2007, 10:23 AM
Thanks pudgerboy! Right now i've made my own dialog, but it would be so much easier to have neat package that does the work, even if it calls on explorer.exe to copy the files.
LoneRobot
10-18-2007, 02:07 PM
but it would be so much easier to have neat package that does the work,
aint that the truth!
relief7
10-21-2007, 11:51 PM
Hi !
I just got into .NET (OMG what a wonderful thing !) and played around a little bit with its standard messageboxes. You are limited to several types (like .yesnocancel or .AbortRetryIgnore) but it gives you much more options than the standard default MAXScript messagebox. It might not be exactly what you wanted but I thought it could maybe be helpful for other cases.
Here is the code I used for testing (including event handling mechanism)
/*
----------------------------------------------------------
System.Windows.Forms.MessageBoxButtons (Enumeration)
----------------------------------------------------------
.AbortRetryIgnore
.OK
.OKCancel
.RetryCancel
.YesNo
.YesNoCancel
----------------------------------------------------------
System.Windows.Forms.MessageBoxDefaultButton (Enumeration)
----------------------------------------------------------
.Button1
.Button2
.Button3
----------------------------------------------------------
System.Windows.Forms.MessageBoxIcon (Enumeration)
----------------------------------------------------------
.Asterisk
.Error
.Exclamation
.Hand
.Information
.None
.Question
.Stop
.Warning
----------------------------------------------------------
MessageBox.show (Method)
----------------------------------------------------------
MessageBox.show ( text, caption, buttons, icon, defaultButton )
*/
(
-- setup dotnet classes / objects
local mb = dotNetClass "System.Windows.Forms.MessageBox"
local buttons = dotNetClass "System.Windows.Forms.MessageBoxButtons"
local icons = dotNetClass "System.Windows.Forms.MessageBoxIcon"
local defaultButton = dotNetClass "System.Windows.Forms.MessageBoxDefaultButton"
local dialogResult = dotNetClass "System.Windows.Forms.DialogResult"
local result = mb.show "Do you want to save before quitting ?" "Quit" buttons.YesNoCancel icons.Information defaultButton.Button3
-- evaluate result of messageBox (which button has been pressed by the user)
if ( result == dialogResult.Yes ) then
(
format "YES\n"
)
else if ( result == dialogResult.No ) then
(
format "NO\n"
)
else if ( result == dialogResult.Cancel ) then
(
format "CANCEL\n"
)
)
erilaz
10-22-2007, 12:47 AM
Thanks markus! Can you copy this post over to the dotNet + MXS (http://forums.cgsociety.org/showthread.php?f=98&t=551473) thread? That will certainly be useful.
relief7
10-22-2007, 01:23 AM
Sure, no problem. Its there now !
CGTalk Moderation
10-22-2007, 01:23 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.