Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Determining if scrollbars are visible
Determining if scrollbars are visible [message #517352] Sat, 27 February 2010 03:53 Go to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
Hi,

I just stumbled upon a bug in (I guess) JFace where a table gets an unneccessary scroll
bar: https://bugs.eclipse.org/bugs/show_bug.cgi?id=304128

I wanted to determine in my unit test if scroll bars are shown for a table. According to
the API docs I thought this would work:

boolean hscroll = table.getHorizontalBar() != null
&& table.getHorizontalBar().isVisible()

Unfortunately this doesn't work (at least not on Cocoa), it always evaluates to true, even
when no horizontal scrollbar is visible. Is this supposed to work or is there a supported
way to get this information?

Greetings,

Ralf


--
http://www.ralfebert.de/blog/eclipsercp/
Re: Determining if scrollbars are visible [message #517663 is a reply to message #517352] Mon, 01 March 2010 11:14 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi,

I think the approach you've tried should work, so you're probably seeing a
bug in swt's Cocoa port.

An alternative approach would be to infer whether the scrollbar would be
visible or not based on the Table's desired and actual heights. This can be
computed with something like:

int desiredHeight = table.getHeaderHeight() + (table.getItemCount() *
table.getItemHeight());
int clientHeight = table.getClientArea().height;
return clientHeight <= desiredHeight;

Grant


"Ralf Ebert" <info@ralfebert.de> wrote in message
news:hma50e$m7b$1@build.eclipse.org...
> Hi,
>
> I just stumbled upon a bug in (I guess) JFace where a table gets an
unneccessary scroll
> bar: https://bugs.eclipse.org/bugs/show_bug.cgi?id=304128
>
> I wanted to determine in my unit test if scroll bars are shown for a
table. According to
> the API docs I thought this would work:
>
> boolean hscroll = table.getHorizontalBar() != null
> && table.getHorizontalBar().isVisible()
>
> Unfortunately this doesn't work (at least not on Cocoa), it always
evaluates to true, even
> when no horizontal scrollbar is visible. Is this supposed to work or is
there a supported
> way to get this information?
>
> Greetings,
>
> Ralf
>
>
> --
> http://www.ralfebert.de/blog/eclipsercp/
Previous Topic:arrayindexoutofbounds when adding a new element to a tableviewer
Next Topic:Could my Windows XP environment be causing this?
Goto Forum:
  


Current Time: Fri Apr 26 11:52:57 GMT 2024

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

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

Back to the top