Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Determining if scrollbars are visible
Determining if scrollbars are visible [message #517352] Fri, 26 February 2010 22:53 Go to next message
Eclipse UserFriend
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 06:14 Go to previous message
Eclipse UserFriend
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: Wed Jul 16 15:35:47 EDT 2025

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

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

Back to the top