ആള്ക്കാര്ക്ക് സാധാരണ dialogbox ബോര് ആണ് .. ഇതു ഇച്ചിരി
രസം ഉള്ള ഒരു ബോക്സ് ആണ് .. ഇമേജ് താഴെ ഉണ്ട് .. കോഡ് കൂടെ
ചേര്ത്തിരിക്കുന്നു
അച്ചായന്
കോഡ് ഇതാ
*
Author:Kurian O.Samuel
e-mail:kurianos@gmail.com
description:
This code will be more style type dialog box for error,warning and info
warning:
This code will not work if all ready any laout ui is opend .. so
each exicution check the layout ui
notes:
I tested that code should work any of maya version 8.5 and after.
Did not check for earlier
usage :put the following line to userSetup.mel
source maya_DialogBox.mel
command Help:
//string $getDialogVal=callHereToLoadWin(title,message,error number,number of buttons,dialog width,button labels)
*/
global string $temREturnPass;
global proc maya_DialogBox(string $title,string $message,int $errorType,int $numberBut,int $widthLay,string $buttonname)
{
string $parseButArray[];
scriptEditorInfo -ch;
$parseButArray=stringToStringArray($buttonname,"-");
$layoutNamePars=$title;
columnLayout -adj true;
rowColumnLayout -nc 2 -cw 1 75 -cw 2 $widthLay;
if ($errorType==1)
{
picture -image "error.bmp";
}
else if ($errorType==2)
{
picture -image "warning.bmp";
}
else if ($errorType==3)
{
picture -image "info.bmp";
}
else
{
confirmDialog -title "Error !!!" -message "This error type is not defined \n" -button "Ok";
scriptEditorInfo -ch;
error "This error type is not defined !!!\n";
}
text -align "left" -l (" "+$message);
text -l "";
text -l "";
setParent ..;
int $getDivHer=$widthLay/$numberBut+20;
string $getThisLayout="rowColumnLayout -nc "+$numberBut;
for ($cntt=1; $cntt<=$numberBut; $cntt++)
{
$getThisLayout=$getThisLayout+" -cw "+$cntt+" "+$getDivHer;
}
$getThisLayout=$getThisLayout+ " mainButtonPan;";
eval ($getThisLayout);
$numberBut=$numberBut-1;
for ($cnt=0; $cnt<=$numberBut; $cnt++)
{
button -p mainButtonPan -l ($parseButArray[$cnt]) -c ("callHereForArg(\""+$parseButArray[$cnt]+"\")") ;
}
return;
}
global proc string confirmDlg (string $title,string $message,int $errorType,int $numberBut,int $layoutWidth,string $buttonname)
{
global string $temREturnPass;
layoutDialog -t $title -ui ("maya_DialogBox(\""+$title+"\",\""+$message+"\",\""+$errorType+"\",\""+$numberBut+"\",\""+$layoutWidth+"\",\""+$buttonname+"\")");
return $temREturnPass;
}
global proc callHereForArg(string $passArg)
{
global string $temREturnPass;
$temREturnPass = $passArg;
layoutDialog -dismiss $passArg ;
}
0 comments:
Post a Comment