View Full Version : updating UI window/controls by changing number?

04 April 2003, 07:12 AM
I'm trying to create a UI where I enter a mesh_# and it pops open the spine controls underneath. charMesh_1 has 3 spine joints, charMesh_2 has 6 joints.

I'm trying to update a slider based on a number ie. $input.
I can select a skinned object by $input and store the spine joints in an array.

Its similar to me creating a text command underneath. They way I have it it creates another text command which I don't want. I want it to take its place and update in the same window.

sphere -n charMesh_1;
sphere -n charMesh_2;
sphere -n charMesh_3;
sphere -n charMesh_6;
select charMesh_1;

if ( `window -exists workPlease` )
deleteUI -window workPlease;

window workPlease;
text -label "mesh_";
textField -width 25 -enterCommand "selByName" renTextField;
string $updateThis;
showWindow workPlease;

global proc selByName()
$input = `textField -query -tx "renTextField"`;
string $meshName = "charMesh_" + $input;
select $meshName;
string $updateThis = `text -label $meshName`;

04 April 2003, 12:30 PM
I'm not quite sure I understand what you are asking. Your code at the bottom will indeed do a new text item since you don't have a "-e". So you are creating a new text label, not editing an existing one.

The usual way I create dynamic ui's is to create some sort of main layout, that I can then delete, and then recreate parented to a true top level master layout and then create new controls over again in the sub layout.


// code snippet fo main proc

columnLayout theMasterLayout;

text - l "Here comes dynamic UI stuff: ";

columnLayout theMainLayout -p theMasterLayout;



// Calling this will create a ui as needed each time,
// first deleting any old junk
global proc refreshUI()
// blow away old layout and any of its children that way
deleteUI -lay theMainLayout ;

// now recreate it
columnLayout theMainLayout -p theMasterLayout;

// make any dynamic stuff here
// ie: we could make a certain # of or type of controls based on
// how many items are selected.

button -l "Refresh" -c "refreshUI();" ;

string $objs[] = `ls -sl`;
if (size($objs) > 0)
button -l "Select 1st object" -c ("select -r "+$objs[0]) ;
text -l "There was nothing selected when UI was refreshed.";


CGTalk Moderation
01 January 2006, 01:00 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.