Listbox... How to make matches of two, is it possible???

3 visualizaciones (últimos 30 días)
Jethro
Jethro el 20 de En. de 2012
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 ?

Respuestas (2)

Walter Roberson
Walter Roberson el 20 de En. de 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.

Sean de Wolski
Sean de Wolski el 20 de En. de 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 comentarios
Jethro
Jethro el 21 de En. de 2012
So, If I add addlistner, every time I select something from the first list box (so I can new the selected value), the second box scrolls at the line corresponding to my value???
Walter Roberson
Walter Roberson el 21 de En. de 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.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by