|
Re: custom table scrolling events? [message #464385 is a reply to message #464382] |
Tue, 22 November 2005 16:14 |
Eclipse User |
|
|
|
Originally posted by: friederich.kupzog.de
Have a look at KTable. It offers the feature of fixed rows and columns.
Regards,
Friederich
Scott Brown wrote:
> I have a table that has a lot of columns, and i'd like to implement my
> own scrolling. i want to make the first 5 columns stationary, and
> scroll the rest of the columns by actually hiding columns. if you
> scroll right, i want to hide column 6, which would shift all the columns
> after column 5 to the left, giving the illusion of scrolling. this sort
> of column scrolling could be very useful to me
>
> but how can i intercept the default scroll event or implement my own?
--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
|
|
|
|
|
Re: custom table scrolling events? [message #464514 is a reply to message #464395] |
Wed, 23 November 2005 16:19 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
You can not intercept the scrolling of the native table.
You could try something like I have below provided you do not need a
vertical scrollbar:
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
final Composite parent = new Composite(shell, SWT.NONE);
// create two tables
int tableStyle = SWT.FULL_SELECTION | SWT.MULTI;
final Table left = new Table(parent, tableStyle);
final Table right = new Table(parent, tableStyle);
right.setHeaderVisible(true);
TableColumn col1 = new TableColumn(left, SWT.NONE);
col1.setWidth(80);
col1.setText("col 1");
TableColumn col2 = new TableColumn(left, SWT.NONE);
col2.setWidth(80);
col2.setText("col 2");
TableColumn col3 = new TableColumn(right, SWT.NONE);
col3.setWidth(200);
col3.setText("col 3");
TableColumn col4 = new TableColumn(right, SWT.NONE);
col4.setWidth(200);
col4.setText("col 4");
TableColumn col5 = new TableColumn(right, SWT.NONE);
col5.setWidth(200);
col5.setText("col 5");
TableColumn col6 = new TableColumn(right, SWT.NONE);
col6.setWidth(200);
col6.setText("col 6");
for (int i = 0; i < 10; i++) {
TableItem leftItem = new TableItem(left, SWT.NONE);
leftItem.setText(new String[] {"asdasd "+i, "qweqweqwe"});
TableItem rightItem = new TableItem(right, SWT.NONE);
rightItem.setText(new String[] {"vbnvn "+i, "qvbnvbnvbn",
"tertetretet", "werwerwerwerwr"});
}
// layout
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = layout.marginHeight = 0;
layout.horizontalSpacing = 0;
parent.setLayout(layout);
left.setHeaderVisible(true);
GridData data = new GridData();
data.widthHint = col1.getWidth() + col2.getWidth() -
left.computeTrim(0, 0, 0, SWT.DEFAULT).width;
left.setLayoutData(data);
right.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
// manage selection
left.addListener(SWT.Selection, new Listener() {
public void handleEvent (Event e) {
int[] selection = left.getSelectionIndices();
right.setSelection(selection);
}
});
right.addListener(SWT.Selection, new Listener() {
public void handleEvent (Event e) {
int[] selection = right.getSelectionIndices();
left.setSelection(selection);
}
});
shell.setSize(400, 400);
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
"Scott Brown" <scottcbrown@gmail.com> wrote in message
news:fb2c99c99aa8d749f2b2cbbbed304082$1@www.eclipse.org...
> i've got it doing my column scrolling by getting the scrollbar from the
> table. i jsut need it to NOT do the regular scroll. how can i intercept
> that event?
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03436 seconds