Made sure Stack.SetStretchy() (like all other layout-changing functions) cannot be called once the parent Window has been opened.

This commit is contained in:
Pietro Gagliardi 2014-02-24 11:19:57 -05:00
parent 8bf2b5cc76
commit f839192c8f
1 changed files with 4 additions and 1 deletions

View File

@ -37,11 +37,14 @@ func NewStack(o Orientation, controls ...Control) *Stack {
} }
} }
// SetStretchy marks a control in a Stack as stretchy. // SetStretchy marks a control in a Stack as stretchy. This cannot be called once the Window containing the Stack has been opened.
func (s *Stack) SetStretchy(index int) { func (s *Stack) SetStretchy(index int) {
s.lock.Lock() s.lock.Lock()
defer s.lock.Unlock() defer s.lock.Unlock()
if s.created {
panic("call to Stack.SetStretchy() after Stack has been created")
}
s.stretchy[index] = true // TODO explicitly check for index out of bounds? s.stretchy[index] = true // TODO explicitly check for index out of bounds?
} }