Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » custom table scrolling events?
custom table scrolling events? [message #464382] Tue, 22 November 2005 14:02 Go to next message
scb  is currently offline scb Friend
Messages: 43
Registered: July 2009
Member
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?
Re: custom table scrolling events? [message #464385 is a reply to message #464382] Tue, 22 November 2005 16:14 Go to previous messageGo to next message
Eclipse UserFriend
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 #464387 is a reply to message #464385] Tue, 22 November 2005 16:38 Go to previous messageGo to next message
scb  is currently offline scb Friend
Messages: 43
Registered: July 2009
Member
i want to be able to do it with the standard swt table widgets
Re: custom table scrolling events? [message #464395 is a reply to message #464387] Tue, 22 November 2005 18:46 Go to previous messageGo to next message
scb  is currently offline scb Friend
Messages: 43
Registered: July 2009
Member
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?
Re: custom table scrolling events? [message #464514 is a reply to message #464395] Wed, 23 November 2005 16:19 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
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?
>
Re: custom table scrolling events? [message #464519 is a reply to message #464514] Wed, 23 November 2005 17:16 Go to previous message
scb  is currently offline scb Friend
Messages: 43
Registered: July 2009
Member
thanks for the response. i was hoping to avoid the 2 table approach, but
i may end up having to do it
Previous Topic:TableTree: Expand toggle in third column?
Next Topic:Change background color for table cell
Goto Forum:
  


Current Time: Thu Apr 18 17:26:18 GMT 2024

Powered by FUDForum. Page generated in 0.02058 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top