the problem of scrollbar
12 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
Fangjun Jiang
2011-5-10
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 个评论
Fangjun Jiang
2011-5-10
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.
更多回答(1 个)
Walter Roberson
2011-5-10
You will have to detect which controls are not in the visible area and set their visibility to be off. See this discussion
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!