Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Table HScrolling Programmatically - A Hack for Win32 platform
Table HScrolling Programmatically - A Hack for Win32 platform [message #451922] Fri, 11 March 2005 03:07
Eclipse UserFriend
Originally posted by: hiroshiwan.notanemail.com

I've been looking up on SWT Table horizontal scrolling in the newsgroups
and forums. The best thing so far is to implement a ScrollComposite with a
Table, which sounds to me pretty tedious.

With the new 3.0 API, it seems there's a showColumn() method in Table that
can help.

NOTE: The "hack" below assumes you know what goes behind the scenes of the
SWT API (for Win32 anyway). If you're not comfortable with that, or not
sure what's going on, it's best you think twice about using it.


I have not developed the idea fully, but looking at the source code of the
showColumn() method, a "hack" can be employed which allows us to achieve
some control over the horizontal scrolling.

Essentially it's just making use of the OS method that showColumn() uses.
The snippet as shown below is FOR WIN32 PLATFORM only:

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.internal.win32.OS;

int scrollVal;
Table _table = new Table(parent, SWT.H_SCROLL);
OS.SendMessage(_table.handle, OS.LVM_SCROLL, scrollVal, 0);

where "scrollVal" is the offset to scroll the Table to.

From what I can tell, "scrollVal" *seems* to be relative to the width of
the client area of the Table, NOT the horizontal ScrollBar.

Again, I have not gone in-depth to look at how to calculate the desired
"scrollVal" (esp. if you're doing a scroll synch with another table), but
I guess it's a start.

Obviously this is going a bit lower level than we should be. But I hope
this can help some ppl out there who really needs a quick solution to this
problem.

Unfortunately, since I only work with the Win32 version of SWT, I can't
advise the same for other platforms, but I guess having a look at the
respective SWT sources will definitely help.

Hopefully, the good people at Eclipse can come up with a solution for all
of us soon.
Previous Topic:Which swt's classes compare to JDesktop & JInternalFrame in swing?
Next Topic:Survey on Understanding Code
Goto Forum:
  


Current Time: Thu Apr 18 06:57:12 GMT 2024

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

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

Back to the top