PDA

View Full Version : Problems updating a formLayout


DeadlyNightshade
01-13-2013, 08:40 PM
The UI of my script is created when the script is run, and what it does is that it creates a list of objects, using a for-loop that runs through an object array, creating a new iconTextButton per object. Later on in the script, I want to be able to rebuild this UI-part and "repopulate" the list and I was looking into doing this by first deleting the old UI, then call on a rebuild-procedure and last but not least update the formLayout.

All of this is working except for the final part: updating the formLayout.

formLayout -edit

-attachControl secondFrame "top" 0 firstFrame
-attachForm secondFrame "left" 0
-attachForm secondFrame "right" 0
-attachControl secondFrame "bottom" 0 lastFrame

myLayout; Generates this error:
Error: line 8: Object 'secondFrame' not found.

...which is a lie because running "deleteUI secondFrame" deletes the UI object. If the object didn't exist I wouldn't be able to run that command, so why is Maya complaining?

The reason I need to do that edit to this formLayout is that I need to re-attach the secondFrame UI-object to the lastFrame UI-object. Right now everything in my script is working except for this final part (as I wrote above), and I end up with a large gap between the second and third frame.

Nyro
01-13-2013, 10:29 PM
Without seeing the whole code, this is the only thing that comes to mind:

is 'secondFrame' a direct child of the formLayout? It must be in order for the formLayout to consider it a valid control.

DeadlyNightshade
01-13-2013, 11:08 PM
Spot on Nyro - that did the trick!
I had parented it to the firstFrame instead of parenting it to myLayout as you suggested.

Nyro
01-14-2013, 12:26 AM
Yeah, the coders eternal nightmare: confounded by a problem, expecting a complicated bug, solution turns out to be trivial :)

CGTalk Moderation
01-14-2013, 12:26 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.