|Table HScrolling Programmatically - A Hack for Win32 platform [message #451922]
||Fri, 11 March 2005 03:07
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
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:
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
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.