Flaye
01-28-2008, 03:21 PM
I've written a simple selection GUI that has both a textFieldGrp and checkBoxGrp.
The textField is for the user to enter a name filter, while the checkBox is to select geometry types. I want to create a warning where if both the textFieldGrp and the checkBoxGrp are left blank, then a warning pops up.
I've tried the && operator but it doesn't work.
global proc selectFilter() {
select -clear;
string $eaCheckNameField=`textFieldGrp -q -text nameFilterField`;
string $eaVerifyCheckBox=`checkBoxGrp -q -value3 typeFilterCheckBox`;
string $eaPadSelection =("*" + $eaCheckNameField + "*");
if (`checkBoxGrp -q -value1 typeFilterCheckBox`){
select -add `listTransforms "-type mesh"`;
}
if (`checkBoxGrp -q -value2 typeFilterCheckBox`){
select -add `listTransforms "-type nurbsSurface"`;
}
if (`checkBoxGrp -q -value3 typeFilterCheckBox`){
select -add `listTransforms -lights`;
}
// THIS IS THE ERROR CATCHING BIT...WORKS FOR BLANK NAME BUT
// NEED TO ADD CHECKBOXGRP BIT
if (!size($eaCheckNameField)){
warning "Please enter a valid name!";
} else{
if (`objExists $eaPadSelection`){
select -add $eaPadSelection;
} else {
warning ($eaPadSelection + " was not found.");
}
}
}
It's Monday morning and I can't think :)
Thanks.
The textField is for the user to enter a name filter, while the checkBox is to select geometry types. I want to create a warning where if both the textFieldGrp and the checkBoxGrp are left blank, then a warning pops up.
I've tried the && operator but it doesn't work.
global proc selectFilter() {
select -clear;
string $eaCheckNameField=`textFieldGrp -q -text nameFilterField`;
string $eaVerifyCheckBox=`checkBoxGrp -q -value3 typeFilterCheckBox`;
string $eaPadSelection =("*" + $eaCheckNameField + "*");
if (`checkBoxGrp -q -value1 typeFilterCheckBox`){
select -add `listTransforms "-type mesh"`;
}
if (`checkBoxGrp -q -value2 typeFilterCheckBox`){
select -add `listTransforms "-type nurbsSurface"`;
}
if (`checkBoxGrp -q -value3 typeFilterCheckBox`){
select -add `listTransforms -lights`;
}
// THIS IS THE ERROR CATCHING BIT...WORKS FOR BLANK NAME BUT
// NEED TO ADD CHECKBOXGRP BIT
if (!size($eaCheckNameField)){
warning "Please enter a valid name!";
} else{
if (`objExists $eaPadSelection`){
select -add $eaPadSelection;
} else {
warning ($eaPadSelection + " was not found.");
}
}
}
It's Monday morning and I can't think :)
Thanks.
