09-30-2012 11:29 PM
I have a docklayout container within another container with absolute layout, here's the docklayout container definition
Container *centerContainer = new Container(); AbsoluteLayoutProperties *props = new AbsoluteLayoutProperties(); props->setPositionX(140.0f); centerContainer->setLayoutProperties(props); centerContainer->setMaxWidth(483.0f); centerContainer->setMinWidth(483.0f); centerContainer->setMinHeight(150.0f); centerContainer->setBottomPadding(10.0f); centerContainer->setTopPadding(5.0f); centerContainer->setLeftPadding(5.0f); centerContainer->setRightPadding(5.0f); DockLayout *centerLayout = new DockLayout(); centerContainer->setLayout(centerLayout);
This container has three elements inserted into it. A multi-line label and two single line labels, defined as follows:
m_Title = Label::create().text("TITLE1").textStyle(m_TitleSt
yle).multiline(true); m_Title->setHorizontalAlignment(HorizontalAlignmen t::Left); m_Title->setVerticalAlignment(VerticalAlignment::T op); //m_Title->setBottomPadding(5.0f); m_Sub = Label::create().text("D_SUB").textStyle(m_SubStyle ); m_Sub->setHorizontalAlignment(HorizontalAlignment: :Left); m_Sub->setVerticalAlignment(VerticalAlignment::Bot tom); //m_Sub->setTopPadding(5.0f); TextStyle commentsStyle = m_SubStyle; commentsStyle.setTextAlign(TextAlign::Right); m_Num = Label::create().text("D_NUM").textStyle(commentsSt yle); m_Num->setHorizontalAlignment(HorizontalAlignment: :Right); m_Num->setVerticalAlignment(VerticalAlignment::Bot tom); //m_Num->setTopPadding(5.0f); centerContainer->add(m_Title); centerContainer->add(m_Sub); centerContainer->add(m_Num);
There are no restrictions placed on the the height of the center container (or the outer container the center container is within). ie. no preferredHeight or maxHeight (although i do have minHeight set).
Why do these labels overlap? When the top label is set to a long string of text it will overlap the other two labels which are stuck to the bottom left and right of the container. Is overlapping expected behavior of docklayout? Had I assigned some height restriction to the container this might make sense, but this behavior does not seem optimal to me when the container is free to take more height to avoid the overlap.
Giving the elements in the docklayout any sort of padding facing eachother does not appear to change the overlapping behavior.
I've attached an image explaining the issue graphically:
10-23-2012 12:34 AM
10-23-2012 12:46 AM