Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » showSelection on List is kinda slow
showSelection on List is kinda slow [message #446053] Wed, 17 November 2004 04:38 Go to next message
Pierce is currently offline PierceFriend
Messages: 42
Registered: July 2009
Member
I am using a org.eclipse.swt.widgets.List widget and filling it with more
items than my application's screen can show. My application selects a
single item in the list according to user input, and to make sure the user
sees this, I call showSelection on the list. It works as advertised, but
it's kinda slow because it scrolls its way down to the selection. Is
there a way to accomplish the same end, but with some sort of jump rather
than a scroll? All I want to do is ensure the user can see the item I
highlighted. Failing that, is there a way to buffer the list information
somehow?

Also, I am not totally sold on the idea of using a List. All I am doing
is showing a list of Strings. There will never be anything fancy in
there. Whatever works and works fast is my goal here.

--PK
Re: showSelection on List is kinda slow [message #446060 is a reply to message #446053] Wed, 17 November 2004 14:25 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Which platform? Can you post a snippet that shows the slowness or enter a
bugzilla report? If you use List.setSelection(), you shouldn't have to
scroll to show the new selection. Also, if you don't mind the list
potentially flashing, you should be able to hide the scrolling using
setRedraw(false)/setRedraw(true). Even so, I'm still very interested in
seeing the code. It's quite possible that Windows is showing you an
animation. Did you try turning off animation from the Windows Control
Panel?

"Pierce Krouse" <pkrouse@austin.rr.com> wrote in message
news:cnekju$ntm$1@www.eclipse.org...
> I am using a org.eclipse.swt.widgets.List widget and filling it with more
> items than my application's screen can show. My application selects a
> single item in the list according to user input, and to make sure the user
> sees this, I call showSelection on the list. It works as advertised, but
> it's kinda slow because it scrolls its way down to the selection. Is
> there a way to accomplish the same end, but with some sort of jump rather
> than a scroll? All I want to do is ensure the user can see the item I
> highlighted. Failing that, is there a way to buffer the list information
> somehow?
>
> Also, I am not totally sold on the idea of using a List. All I am doing
> is showing a list of Strings. There will never be anything fancy in
> there. Whatever works and works fast is my goal here.
>
> --PK
>
Re: showSelection on List is kinda slow [message #446127 is a reply to message #446060] Wed, 17 November 2004 15:38 Go to previous message
Pierce is currently offline PierceFriend
Messages: 42
Registered: July 2009
Member
Steve Northover wrote:

> Which platform?
Windows 2000.

> Can you post a snippet that shows the slowness or enter a
> bugzilla report?

Well, the call is doing what it says it does, albeit rather slow. I
didn't want to toss something in the bug tracking system without fully
investigating what was going on.

> If you use List.setSelection(), you shouldn't have to
> scroll to show the new selection.

You're right in one regard -- using setSelection instead of select does
mean I don't have to use the showSelection call to make it visible.
However, it still scrolls sluggishly.

> Also, if you don't mind the list
> potentially flashing, you should be able to hide the scrolling using
> setRedraw(false)/setRedraw(true).

That did the trick!

> Even so, I'm still very interested in
> seeing the code.

OK, it's nothing fancy. This code selects the first candidate from a list
as the user enters data into a Text widget. It's a list of names. If the
user types s, the list jumps to the first name beginning with s (i.e.
Samms, Ron). If the user then hits m, they will be brought to the first
sm name (i.e. Smith, John). Here's what I am doing on the key released
event. PAram is the text of the input field:

private int findClosest(String key){
for(int i=hint;i<items.length;i++){
int lex = items[i].compareToIgnoreCase(key);
if (lex >= 0) {
hint = i;
break;
}
}
//lister.select(hint);
lister.setRedraw(false); // stops the scroll
lister.setSelection(hint); // as per Steve Northover's suggestion
lister.setRedraw(true); // back to normal
//lister.showSelection(); // make sure its visible
System.out.println("current item:"+lister.getItem(hint));
return hint;
}// findClosest




> It's quite possible that Windows is showing you an
> animation. Did you try turning off animation from the Windows Control
> Panel?

I was skeptical of this idea, but I tried it anyway and sure enough there
was a Transition effects setting under Display->Effects that was affecting
performance a LOT. I turned it off and the thing sped up to what I would
call an acceptable level. I am sticking with the setRedraw() method
because it works as well, and leaves me in control without depending on
what the user has set in their control panel.


I was going to try doing this with a ListViewer, but I never got it to
work -- I couldn't set any filters or sorters without it cratering at
runtime with a useless message. Thanks for the suggestions Steve.

--PK
Previous Topic:The SWT_AWT bridge and Solaris
Next Topic:About the underlying system
Goto Forum:
  


Current Time: Sat Apr 20 02:56:26 GMT 2024

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

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

Back to the top