[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: tree layout

TableLayout is not really a satisfactory answer for Table or Tree.  The idea 
of TableLayout is probably going to be rethought post 3.1 and therefore it 
does not make too much sense for a copy of TableLayout to be created for 
Tree.  The work being done in TableLayout can quite simply be done with  a 
resize listener.  For example, the PropertySheet view does the following:

tree.addControlListener(new ControlAdapter() {
    public void controlResized(ControlEvent e) {
        Rectangle area = tree.getClientArea();
        TreeColumn[] columns = tree.getColumns();
        if (area.width > 0 && columns[0].getWidth() == 0) {
            columns[0].setWidth(area.width * 40 / 100);
            columns[1].setWidth(area.width - columns[0].getWidth() - 4);
            tree.removeControlListener(this);
        }
    }
});

"Christian Sell" <christian.sell@xxxxxxxxxxxxx> wrote in message 
news:d43kd3$tb7$1@xxxxxxxxxxxxxxxxxxx
> hmm, I dont think I understand the conclusion. Right now, Tree is not able 
> to fully replace TableTree, as there are no similar layout facilites (in 
> fact, there seem to be none). So, in order to avoid API change, the only 
> way would be to remove the deprecation IMO..
>
> chris
>
> Grant Gayed wrote:
>> I don't think so since api is frozen for 3.1.  This was logged recently, 
>> see
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=91662 .
>>
>> Grant
>>
>> "Christian Sell" <christian.sell@xxxxxxxxxxxxx> wrote in message
>> news:d4135f$hcr$1@xxxxxxxxxxxxxxxxxxx
>>
>>>I just copied TableLayout into a TreeLayout class and changed the
>>>(Table) casts to (Tree) casts. All was well afterwards. I assume there
>>>will be some change before 3.1 GA that makes the same class usable in
>>>both cases?!
>>>
>>>chris
>>>
>>>Christian Sell wrote:
>>>
>>>>Hello,
>>>>
>>>>after migrating to Eclipse 3.1M6, I switched my app from
>>>>TableTree(Viewer) to Tree(Viewer) because the forme has become
>>>>deprecated. However, I am now looking for a layout to attach to the Tree
>>>>in the same way that a TableLayout is attached to a Table. In
>>>>particular, I am looking for ways to specify the relative weight of the
>>>>columns, and the automatic resizing that is performed by TableLayout.
>>>>
>>>>Can anybody help?
>>>>
>>>>thanks,
>>>>christian
>>
>>