the problem of scrollbar

21 Ansichten (letzte 30 Tage)
zhiping
zhiping am 10 Mai 2011
hello,recently I'am doing an interface with matlab. And I have realized this funtion of scrollbar with a slider. But for now there is a problem, and I didn't find the solution in internet. I use a window like a scrollbar. In this window I want to display many panels. There are several buttons such as 'exit' and 'listbox' in each panel. Then I move the button slider to control the displacement of the inner panels, when the inner panels rise out of the border of scrollbar, some of the butttons can be seen. here I give you a lien of the photo for know what it happens. http://www.utc.fr/filex/get?k=kMTFDgmex6UrXZ4kdDr Can you give me some advice? Is there a solution? merci d'avance

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 10 Mai 2011
I understand that you want to have the effect that when you move the scroll bar, you want the buttons in the panel move up and down, just like the typical windows interface that we use all the time. It is a little bit hard to do that in Matlab GUIDE. The "Panel" is just a container. It doesn't have a scroll bar built in. The "Listbox" has a built-in scroll bar. You can see it has the property called "SlideStep". The "Slider" that you used is typically used for numerical input. It's not automatically linked to your panel.
Technically, you can write functions to realize what you want. In the callback function of your "Slider", you can read the "Slider" input and then change the positions of all the buttons in the "Panel" accordingly. Make sure the positions are all relative to the "Panel".
This is really a stretch way to do. I am not sure how the final effect will look like (how fast the GUI refresh).
  3 Kommentare
Fangjun Jiang
Fangjun Jiang am 10 Mai 2011
I see. I thought once the position of the child panel is outside of the parent panel, it won't be visible. But apparently it is not the case. Make the child panel invisible could be a solution. But it is on/off and doesn't have the visual effect of gradually moving out.
Would you consider tackling the problem from a different angle? Your problem is that you don't have enough real estate to place those child panels. A GUI like tab panel could solve the problem. You put all your child panels into several categories. Every time a tab is clicked, you just show one category of those child panels.
Unfortunately, there is no tab panel element in GUIDE (at least in R2007b). So I used a list box. Every time the user select an item in the list box, one set of child panel is shown and all the others are hidden. It worked perfectly well.
zhiping
zhiping am 11 Mai 2011
Thanks a lot. According to your advice, I tried to use the tabpanel. It's very simple to have resolved my problem. My matlab is R2011a, so I can use the function of tabpanel, fortunately, :-)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 10 Mai 2011
You will have to detect which controls are not in the visible area and set their visibility to be off. See this discussion

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by