Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Simple UI question - odd attachOppositeControl behavior?
  RSS 2.0 ATOM  

Simple UI question - odd attachOppositeControl behavior?
Rate this thread
 
62329
 
Permlink of this thread  
avatar
  • Total Posts: 8
  • Joined: 12 October 2011 01:47 PM

These two UI’s are the same, except the second has an additional “attachOppositeControl” to make the button’s left side line up with the scroll list.  Why does this result in the window’s left side bloating out?  What am I missing?

Thanks!

uiquestion.jpg

Here’s the code:

from pymel.all import *
def windowTestA():
    if 
Window.exists('explainMeA'):
        
deleteUI('explainMeA')
    
windowA window('explainMeA'title 'Explain Me A')
    
formA formLayout(parent windowA)
    
items iconTextScrollList(parent formA)
    
button_pressMe button(label 'Press Me')
    
formLayout(formAedit TrueattachForm [(items'top'10), (items'right'10), (items'bottom'50)])
    
formLayout(formAedit TrueattachControl [(button_pressMe'top'10items)]attachOppositeControl [(button_pressMe'right'0items)])
    
    
windowA.show()
windowTestA()

from pymel.all import *
def windowTestB():
    if 
Window.exists('explainMeB'):
        
deleteUI('explainMeB')
    
windowA window('explainMeB'title 'Explain Me B')
    
formA formLayout(parent windowA)
    
items iconTextScrollList(parent formA)
    
button_pressMe button(label 'Press Me')
    
formLayout(formAedit TrueattachForm [(items'top'10), (items'right'10), (items'bottom'50)])
    
formLayout(formAedit TrueattachControl [(button_pressMe'top'10items)]attachOppositeControl [(button_pressMe'right'0items), (button_pressMe'left'0items)])
    
    
windowA.show()
windowTestB()


Replies: 0
avatar
  • ldunham1
  • Posted: 28 November 2011 08:12 AM

seems to be linked with your initial formLayout. Your only attaching it to top, bottom and right. I dont know why its cause the left to ‘bloat’ out, but adding a left parameter fixes the issue.

from pymel.all import *
def windowTestC():
    if 
Window.exists('explainMeC'):
        
deleteUI('explainMeC')
    
windowC window('explainMeC'title 'Explain Me C')
    
formA formLayout(parent windowC)
    
items iconTextScrollList(parent formA)
    
button_pressMe button(label 'Press Me')
    
formLayout(formAedit TrueattachForm [(items'top'10), (items'right'10), (items'left'10), (items'bottom'50)])
    
formLayout(formAedit TrueattachControl [(button_pressMe'top'10items)]attachOppositeControl [(button_pressMe'right'0items), (button_pressMe'left'0items)])
    
    
windowC.show()
windowTestC()

Hope that helps.



Lee Dunham | Character TD
ldunham.blogspot.com

Replies: 0
avatar

That helps a lot!  Thank you!



Replies: 0