View Full Version : help on intField pls...

01 January 2008, 08:31 AM
thanks for viewing

i have an intField. and i need to put the number thats typed onto into a variable. so i can use it for some procedures.

thanks guys. this is driving me nuts.

you are my brother

01 January 2008, 08:54 AM
hmm...sorry i don't really get the problem.

so you have an int array and you want to use those values in a procedure?

int values[];
values[0] = 3;


i'm pretty sure that this isn't really your problem so please specify where you get errors.

see you!

01 January 2008, 09:15 AM
that was a fast reply hehehe

anyways...heres my problem in more detail...
i made a UI that has an intField in it.
i need to get whatever value was typed in the intField into a variable.
something like

int $number = `intSliderName`;

so that i can use the $number to drive some other stuff in my procedures.

anyways. i hope you understood me. pls forgive me since i am just new to programming,so im still getting a hold on programming jargons hehehe

thanks a lot :)

01 January 2008, 04:17 PM
well this is an attribute that you've defined. to get the values of a attribute do this:

int $value = 0;
$value = `getAttr Object.number`;

...where $value is the place where the float value will be stored. object is your node and number is your float attribute.

if you need more details just ask or look it up in the documentation. there are some examples

01 January 2008, 03:08 AM
thanks gravedigger.

getAttr would be easy if i were querying an attribute. however,i need to get the exact number that was typed in the intField. ill try to post some stuff later :) my boss is here.

01 January 2008, 03:45 AM
it's a very simple task, so i'm assuming you're somewhat new to mel.
hope the following code makes sense to you.
good luck,

////////////// create a UI

window myWindow; // create a window called "myWindow"

columnLayout; // create a columnLayout

intField myIntField; // create an intField called "myIntField"

showWindow myWindow; // display the window

///////////// query whatever value is in the intField

int $myVar; // create a variable called "myVar"

$myVar = `intField -query -value myIntField`; // query the value from the intField called "myIntField" and save it in the variable "myVar"

01 January 2008, 03:58 AM
$myVar = `intField -query -value myIntField`;

COOL! i guess thats what i needed. i always knew that its the -q flag but i just didnt know how to format it. LOL

thanks :D ill try it as soon as i can.

CGTalk Moderation
01 January 2008, 03:58 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.