Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [albireo-dev] SWT size/layout management

Bruno Haible wrote:
Hi Gordon (or anyone else who knows it),

When the SwingControl's size changes, we do

      getParent().layout();

We really shouldn't call it at all. I haven't had a chance to study the recent changes, but the code in my current workspace only calls layout() when we *first* get a real size for the embedded AWT component. This is necessary only because we can't query the AWT component for its current size from the SWT thread. But even this problematic, and I think that is what is implied by your questions below.


Why not    getParent().getParent().layout();     ?

Why not    getParent().getParent().getParent().layout();     ?

The SWT model forces the application to decide when to force a re-layout by calling layout().


In contrast, Swing's relayout mechanism climbs up to the next "validation root",
i.e. the next component in the ancestors list which is known to isolate size
changes in its children from its parent (i.e. which is known to have constant
size, regardless of its children).

I don't know of any analogous concept in SWT. It's up to the application. In effect, eveything is a validation root.




Back to the top