I've to create a dynamic GUI that keeps increasing in size as the
user selects and adds more stuff to it. The only way to do so is to
start with a minimal interface and as the user adds more stuff, add a
vertical scroll bar and the user can see the whole GUI as it keeps
increasing in size.
Now there is no way that I can predict the actual size of the GUI. It
depends entirely on what and how much the user selects, which will
vary from case to case.
I tried searching through the newsgroup and the file exchange to
implement this using a slider, but couldn't find an option.
Just some additional info if that helps :
There are no pictures, or graphs on this GUI. The user selects a
directory using a button and check boxes pop up with subdirectories
of the selected directory in a panel and the user can select the ones
they want. Now he can select another directory and so on and more of
these panels with check boxes pop up. This can go on for as long as
the user wishes. And all the panels that popped up could be reviewed
later once the user is done adding directories. This is where the
scroll bar comes in.
Thanks
>I've to create a dynamic GUI that keeps increasing in size as the
>user selects and adds more stuff to it.
>Just some additional info if that helps :
>There are no pictures, or graphs on this GUI.
Create a uipanel() for the area that you wish to be able to
scroll. Within that uipanel, place the slider, and place a second
uipanel that covers the area that the slider does not and whose
parent is the first uipanel. Have the slider change the position of the
second uipanel within the first uipanel. Parent everything that has
to be scrollable within the second uipanel.
The key to this is two-fold: 1) objects such as uicontrols will automatically
move as a group when their parent (the inner uipanel) moves; and
2) the outer uipanel will clip the inner uipanel.
--
If you lie to the compiler, it will get its revenge. -- Henry Spencer
If you only want to scroll part of the gui (like a website with
frames) you can put the panel behind a "frame" made out of other
(nonscrolling) panels or empty text uicontrols so that the frame
forms a window and you can see a portion of the panel through the
window.
If you need to make more than one scrolling section, you'll need to
come up with something more clever...
Thanks Matt and Walter for the replies.
I've decide to go with one uipanel inside another and using the
slider to move the inside panel which will contain all the required
buttons and checkboxes.
One question though :
Currently I'm using 2007a version and it has the uipanel and it's all
good. But will this work on older versions of Matlab as they seem to
have frames instead of panels?
If you're concerned about backward compatibility you can always use
frames, which are still supported. Although removed from GUIDE, you
can set them up programatically using uicontrol.
Yair
Hi,
Does anyone have example code of this? I'm a little puzzled
as to what happens when my scrollable panel is bigger than
my figure (so far, I get an error from guide).
Thanks,
Danielle
Have you got the Vertical Scroll bar working? Can you share your code? I am in the same situation now.
Thank you,
Audrey
ann <kidu.N...@gmailNOSPaM.NOSPAMcom> wrote in message <ef587...@webcrossing.raydaftYaTP>...
You will need your own hMainPanel, as well as different locations/
positions
%% creates scrolling panel
function buildTestPanel()
pictureFrame = uipanel('Parent', hMainPanel, ...
'Position', testPanelLoc);
scrollingPanel = uipanel('Parent', pictureFrame, ...
'Position', scrollingPanelPos);
uicontrol('Style', 'slider', ...
'Parent', pictureFrame, ...
'Units', 'normalized', ...
'Value', 1, ...
'Position', [.95, 0, .05, 1], ...
'Callback', @scroll);
end
%%%% end buildTestPanel
%% Callback for the scrolling slider %%%%
function scroll(src, eventdata) %#ok
movingPanel = findobj(get(src, 'Parent'), ...
'Tag', 'scrolling_panel');
val = get(src, 'Value');
change = [0, val-1, 0, 0];
set(movingPanel, 'Units', 'normalized', ...
'Position', scrollingPanelPos-change);
end
%%%%