Hello, I would like to know how to recover the value of the object selected in an option menu for example the name of a camera. The optionMenu containing a list of camera.
source code :
//D
Hello, I would like to know how to recover the value of the object selected in an option menu for example the name of a camera. The optionMenu containing a list of camera.
source code :
//D
CODE
global proc getSelectedFromOption()
{
string $getSelectedOption=optionMenu -q -v mycamlisthere;
print ($getSelectedOption+"\n");
}
It could be:
CODE
global proc cameraSelect()
{
select optionMenu -q -v mycamlisthere;
}
But for those simple arrays I'd really suggest the for-in loop its ... more cool :]
CODE
for($cam in $listeCamera)
{
menuItem -label $cam -command ("select " + $cam + ";");
}
See? You don't have to declare further variables.
And actually you don't need another proc. You can pack the selection command into the optionMenu directly.:
CODE
optionMenu -label "Camera"
-cc ("select optionMenu -q -v mycamlisthere;")
mycamlisthere;// d
I have a new problem !!!!!
//D
QUOTE(xabi @ 03/29/06, 11:16 AM) [snapback]232617[/snapback]
I have a new problem !!!!!
No kidding! Dont duble post tough. Its that allmost your enbtire code is the problem, mainlly because theres no clear aim to it. What the point of the WHole thing your trying to do!
Anywway theres a serious design flaw here. Firstoff its like im seeing half of the code. Also ifd im not then fopen without a corresponding fclose is a possible MEGADISATER. Anyway theres no fileopen so the line
fprint $file $toto; //does not make sense without it.
NOw anyway.
for($k=0 ; $k<size($listeCamera) ; $k++)
{
string $toto=optionMenu -cc "cameraSelect" -e mycamlisthere;
menuItem $listeCamera[$k];
}
reads somethging akin to
my name is now bob.
my name is now bob.
my name is now bob.
write out my name. // my name is now bob (and not bob bob bob)
this. Anwyay its jsut waste of computation cycles Tough to be honest theres not mcuh point in this at all:
optionMenu -label "Camera" mycamlisthere;// d
It's good!!!!
Thank you very much!!!
Xabi? Read my last post? It was almost the same suggests as Joojaas..
Another thing:
If you gotta problem with a special part please try to extract it and don't write the whole code again in here. It fills up the board with redundant stuff and is harder to read and understand. Secondly: Try to make use of the Code-Buttom ^
CODE
#
If youre in a case to present your stuff you can still show it us all to have a look onto it ;]