[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: How to trigger re-layout of form (same as what resizing the window does)
|
Maybe layout(true, true) needs to be called on a high-level composite in the
widget hierarchy than has been tried. Calling layout(true, true) is almost
always the answer when layouts get successfully updated on shell resize.
Grant
"Matthew Hall" <matthall@xxxxxxxxxxxxxxxxx> wrote in message
news:g29hnk$v6g$1@xxxxxxxxxxxxxxxxxxxx
> Mike,
>
> Can you post a standalone snippet that shows the problem you're seeing?
>
> Matthew
>
> Mike Yawn wrote:
> > I've spent hours on this, and the behavior seems completely random to
> > me. Hoping someone can clue me in on the magic incantation.
> >
> > I have a form where the left hand side has a tree, and the content of
> > the right-hand side varies depending on the tree selection. Regardless
> > of what is selected in the tree, the width of the form shouldn't change,
> > so everything should get laid out on the right side to fill the
> > available space.
> >
> > Everything uses GridLayout, and all GridDatas are set to fill
horizontal.
> >
> > When I change the tree selection, sometimes the components are drawn
> > correctly and exactly fill the available space. Sometimes they aren't
> > wide enough (fill horizontal seems to be ignored) leaving excess white
> > space, and sometimes they are too wide (so they extend beyond the page
> > boundaries).
> >
> > However, if I resize the window, everything snaps to exactly the right
> > size. This seems to me to indicate that all of my layout, griddata,
> > etc. stuff is right, and that the layout just isn't being re-calculated
> > as needed when a tree selection changes.
> >
> > So I've tried calling pack, layout, reflow, getParent.pack,
> > getParent.layout(true, true), calling these various calls on many
> > different combinations of the form, the body of the form, the composite
> > for the right side of the form, individual components -- nothing seems
> > to work.
> >
> > Since resizing the form seems to work, what is it that the workbench is
> > calling when the form is resized, so that I can make the same call
> > myself when a tree selection changes?
> >
> > Thanks
> > Mike