0
string $formEX = `formLayout -numberOfDivisions 100 -p formLayout5`;
string $buttonEX = `button -l "button" -h 26`;

$formLayout8 = `formLayout -q -ca formLayout5`;

formLayout -e
-attachForm $buttonTime "top" 0
-attachForm $buttonTime "left" 0
-attachForm $buttonTime "bottom" 0
-attachForm $buttonTime "right" 0
$formEX

////////////////////////////execute till here//////////////////////////////////
/////////////////seperately execute this code/////////////////////

formLayout -e -attachForm $formTime "top" 0
-attachForm $formTime "left" 0
formLayout8

i am not understanding why code giving error? how to get ui element name?"formlayout8" is working with query flag for examle like(formLayout -q -p formLayout8)but i cant merge my own formLayout with that existing one...any help appreciated.... thank you.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Anvesh Chary
  • 65
  • 1
  • 11

1 Answers1

1

Please see the example on the mel documentation for a simple breakdown here.

You've made it a little difficult for us to debug because you're missing code.

If you format your code like the linked example, it will be much easy to follow, mel UI creating has never been a joy to write.

Your problem lies with you're trying to attach items to a form name formLayout8, where you've defined it as a variable $formLayout8, simply add the dollar sign before the name, and remember to close off the line with a semi-colon;

Without knowing what the rest of your code looks like, i can only assume that the errors you have in your code already, is the problem:

string $formEX = `formLayout -numberOfDivisions 100 -p formLayout5`;
string $buttonEX = `button -l "button" -h 26`;

$formLayout8 = `formLayout -q -ca formLayout5`;

formLayout -edit
    -attachForm $buttonTime "top" 0
    -attachForm $buttonTime "left" 0
    -attachForm $buttonTime "bottom" 0
    -attachForm $buttonTime "right" 0
$formEX;    

formLayout -edit
    -attachForm $formTime "top" 0
    -attachForm $formTime "left" 0
$formLayout8;

If you have a form with a name of formLayout8, similar to:

string $form = `formLayout  -numberOfDivisions 100 "formLayout8"`;

Simply just double quote around the name:

formLayout -edit
    -attachForm $formTime "top" 0
    -attachForm $formTime "left" 0
"formLayout8";
Shannon Hochkins
  • 11,763
  • 15
  • 62
  • 95
  • Actually that i had seen statusline mel script in maya installation folder and found some formLayout's in script, after doing some debug and i found statusline button names and formLayout names. $formEX is declared by me and $formLayout8(actually it is formLayout8 i had declared like that) is already declared. my problem formLayout8 is working when iam querying but not in edit mode. hope iam understood if not reply me @Shannon Hochkins.... thank you. – Anvesh Chary Apr 28 '14 at 04:52
  • Sorry I'm not following @AnveshChary, what is the error message you're receiving? – Shannon Hochkins Apr 28 '14 at 06:15
  • Do you mean you have a formLayout with with a name of `formLayout8`? – Shannon Hochkins Apr 28 '14 at 06:23
  • formLayout8 is already declared while launching maya and this formlayout is for status line ui element. if u have maya installed you can try this code and u'll understand what iam talking about.... – Anvesh Chary Apr 28 '14 at 06:42
  • 1
    UI controls get their names when they are created - if you opened and then closed your UI the next version might not get the name formLayout8. It's always better to be explicit – theodox Apr 28 '14 at 17:03
  • I was about to say why not just name your layouts to avoid the conflicts? – Shannon Hochkins Apr 28 '14 at 21:58
  • sorry u din't got me formLayout8 is not created by me.... it is maya's default layout so just i wanted to create one more layout beside that but it is only available for self query and editing purpose when iam trying to attach my layout to already existing one "the error says that $formEX(which was created by me) not found.... is it am clear? – Anvesh Chary Apr 29 '14 at 04:39
  • No, maybe re word your question, with what you're trying to achieve, and where the problem lies, include all current working code, and then mention where your problem lies because you're not making sense sorry. – Shannon Hochkins Apr 29 '14 at 06:32