Listbox... How to make matches of two, is it possible???
3 views (last 30 days)
Show older comments
Hi everybody!!
I'd like to create two listboxes that scrolls with the same scrollbar... Is it possible?? My aim is to insert two arrays that are related to each other. I can't use cellarrays because of my code...
Can I match two listboxes like two columns of a table??
Or if someone know how to use uitable to set rows and columns starting from arrays length, can you answer here: http://www.mathworks.it/matlabcentral/answers/26624-uitable-how-to-set-number-of-rows-columns ?
0 Comments
Answers (2)
Walter Roberson
on 20 Jan 2012
If it could be done to synchronize the scrolling of two listboxes, it would have to be at the Java level. Scrolling does not (as far as I know) create an event that could be used to trigger the transfer of the scroll information to another box.
At any particular point, you can get() or set() the ListBoxTop property, which is the current scrolling amount. You just don't get notified that it has changed. Though I suppose you could waitfor() the property to be changed; I am not sure if that would work, but it might.
If you do not mind an explicit user action to request synchronization, you could set the ButtonDownFcn property of the listbox, which the user would activate by right-clicking (left clicking would be for selecting the entry still); that would give you notice to set the ListBoxTop to be the same.
0 Comments
Sean de Wolski
on 20 Jan 2012
You could possibly add a post-set listener to the ListBoxTop property that updates the other one whenever the first one is changed.
doc addlistener
2 Comments
Walter Roberson
on 21 Jan 2012
addlistner gives you an opportunity to have a routine called when an event occurs. The routine you designate would have to check the ListBoxTop of the list being scrolled, and would have to set() the ListBoxTop of the other list.
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!