UI Interest Group Blog

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Iphone-like scrolling through controls

PelleS
Active Participant

First of all, excuse me if someone else already done this, but I can't find a similar example.

The attached example shows how to implement the "fluid-like" way of scrolling through a list of apps (i.e. controls) just like you see in smart phones. You left-click the mouse to grab onto the list and when you move the mouse the list will follow. As you release the mouse the velocity is calculated and the scrolling attenuates gradually.

I have used a cluster to group the controls to get a cleaner code, but I guess you could scroll the panel just as well, or a listbox or....whatever. The thing you need to do is to dynamically change the objects position. In this example I have only implemented a vertical scroll.

The code is developed without any subvis and without any elaborate design. I have only tried to quickly create an example for you to build from.

So please try to optimize this before you implement it in a real program. The scrolling is eating lots of CPU, that's because mouse move events are triggered all the time. Probably a producer-consumer design pattern would be more efficient.

Untitled.png

To get nice icons I have just used the boolean system controls found here: http://decibel.ni.com/content/docs/DOC-9921

/Pelle

Pelle S
Account Manager
National Instruments Sweden
Download All
Comments