[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Skipping Columns, Highlite selected Cell, Scroll vertically

Hi,

Ok I see the problem. The dumb TreeViewerEditor calls methods like this:

> protected void updateFocusCell(ViewerCell focusCell,
> 			ColumnViewerEditorActivationEvent event) {
> 		// Update the focus cell when we activated the editor with these 2
> 		// events
> 		if (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC
> 				|| event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) {
> 
> 			List l = getViewer().getSelectionFromWidget();
> 
> 			if (focusCellManager != null) {
> 				focusCellManager.setFocusCell(focusCell);
> 			}
> 
> 			if (!l.contains(focusCell.getElement())) {
> 				getViewer().setSelection(
> 						new TreeSelection(focusCell.getViewerRow()
> 								.getTreePath()),true);
> 			}
> 
> 		}
> 	}

I was on the way to suggest that you overload the
FocusCellHighlighter#focusCellChanged() but unfortunately afterwads a
the selection is reset and then the tree scrolls back to the beginning.

=> The only chances I see currently:

- Tab and Scrolling horizontally: Write your own TreeViewerEditor and
add a line like this:
--------8<--------
Tree t = (Tree) getViewer().getControl();
t.showColumn(t.getColumn(((ViewerCell)event.getSource()).getColumnIndex()));
--------8<--------
at the end.

- Cursor-Navigation:
Write your own FocusCellHighlighter and over insert code like the one
from above in the FocusCellHighlighter#focusCellChanged. I need to leave
now but I'll try to write a snippet and make it available.

Tom

Thomas Eichstädt-Engelen schrieb:
> 
>> So I understand right that the only remaining problem is 5?
> 
> no :-) 1,3(partially),4,5
> 
> The FocusCellOwnerDrawHighlighter highlites just a cell. I'd like to
> have a highlited row (like default behaviour when not using
> FocusCellOwnerDrawHighlighter) and additionally highliting the focused
> cell at the same time (border).
> 
>> if you modify the code in the activation strategy like this you get
>> horizontal scrolling (vertical should work out of the box).
> 
> if i understood you correctly. If i select one cell in tree (1 of 20
> columns) and navigate with cursor or tab vertically, the tree should
> follow? That does not work on my machine (macos, jdk1.5, eclipse 3.4)
> 
> Many thanks,
> 
> Thomas E.-E.
> 
> 
> 
>>>>> i am developing an excel-like editor. I am using a tree
>>>>> (TreeViewer) to
>>>>> visualize data. There are many columns in each row. What i'd like to
>>>>> accomplish is the following:
>>>>>
>>>>> 1. Tabbing with the Tab (which does not work on my MacOS machine)
>>>>> 2. having the selected row highlited
>>>>> 3. having the selected cell framed
>>>>> 4. skip to only 6 (out of 20) columns in each row, because only those
>>>>> six columns are editable.
>>>>> 5. scroll vertically when tabbing to a column which is not visible so
>>>>> far.
>>>
>>>
> 
> 
> 
> 


-- 
B e s t S o l u t i o n . at
--------------------------------------------------------------------
Tom Schindl                                          JFace-Committer
--------------------------------------------------------------------