Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   UI question (https://simplymaya.com/forum/showthread.php?t=12632)

suzanne 16-07-2004 01:31 AM

UI question
 
I am designing a simple user interface. I want user to input 2 separate float values, a text string, and select from a choice of 2 items. I want the window I create to behave like a `promptDialog ... ` but with the required embedded fields:
floatFieldGrp (2), textFieldGrp (1), and radioButtonGrp. I want execution of Mel script to stop until user presses "OK" button ... and then be able to query the inputs of the others fields entered and continue on ...

can a confirmDialog or promptDialog be embedded inside window command ?

How can I get Mel script to query field inputs and then close window ?

Here is some code ... but it doesn't do what I want ....
and its really a pain to do a series of `promptDialog ...` commands in order to get

all the info before Mel script continues.


---cut cut cut---

proc queryInput(string $posScaleField, string $distanceScaleField, string

$fileNameField, string $camSwField)
{
global float $posScale;
global float $distScale;
global string $fileName;
global int $camsw;

$posScale = `floatFieldGrp -q -v1 $posScaleField`;
$distScale = `floatFieldGrp -q -v1 $distanceScaleField`;
$fileName = `textFieldGrp -q -text $fileNameField`;
$camSw = `radioButtonGrp -q -select $camSwField`;

}


global proc mfExporter()
{
.
.
.

string $myWindow = `window -title "Export file" -rtf true`;
columnLayout;
string $posScaleField = `floatFieldGrp -label "position scale:" -v1 1.0`;
string $distanceScaleField = `floatFieldGrp -label "distance scale:" -v1 1.0`;
string $fileNameField = `textFieldGrp -label "input file name:"`;
string $camSwField = `radioButtonGrp
-numberOfRadioButtons 2
-label "Select camera type:"
-labelArray2 "Target" "Free"
-select 1`;
rowLayout -nc 2;
button -label "OK" -command "queryInput($posScaleField, $distanceScaleField,

$fileNameField, $camSwField)";
button -label "Cancel" -command "someExitProc()";

showWindow $myWindow;


----cut cut cut----

... if only button could behave like one from a promptDialog ???

mark_wilkins 23-07-2004 05:19 AM

You're very close. Two things I notice: first, the names of the field groups need to be global variables to be accessible in the call to queryInput in the button command. Also, you should close the window in the queryInput proc.

There are an example or two of this in MEL Scripting for Maya Animators in the section on custom dialog boxes, by the way.

-- Mark


All times are GMT. The time now is 07:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018