How to improve GUI
1 view (last 30 days)
Show older comments
Hi I'm trying to create a GUI that use several algorithms and functions and, some of the things that I am trying to do is to call GUIs with other GUIs but I don't want to create a GUI that callsback another one but rather I want one that can integrate the three GUIs in one, kind of the tab systems in Chromme or another explorer.
Thanks
0 Comments
Accepted Answer
Fangjun Jiang
on 30 Aug 2011
According to this post, there is tab-panel capability in R2011a. I don't have R2011a so don't have hands-on experience. But even if you don't have tab-panel, there is also a practical approach to help you organize your GUI elements.
Here is the link from TMW. It seems to be still a "undocumented feature" in R2011a. http://www.mathworks.com/help/techdoc/uitools_csh/error_pages/bslcn87.html
3 Comments
Fangjun Jiang
on 31 Aug 2011
I put all my elements that are corresponding to that listbox option inside a panel. I only need to set the visibility of the panel to be off to hide all the elements inside the panel. Remember, if you have multiple options, at any time, you want to turn on one panel and turn off one panel. So you need to have a way to remember the panel that was previous on. I use 'UserData' for that. The code is pretty simple. I don't have a good idea what is your problem. It sounds like not related to this particular technique.
function OptionList_Callback(hObject, eventdata, handles) %#ok
% hObject handle to OptionList (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns OptionList contents as cell array
% contents{get(hObject,'Value')} returns selected item from OptionList
contents = get(hObject,'String');
CurrentSelection=contents{get(hObject,'Value')};
PreviousSelection=get(hObject,'UserData');
set(hObject,'UserData',CurrentSelection);
set(handles.([PreviousSelection,'Panel']),'Visible','Off');
set(handles.([CurrentSelection,'Panel']),'Visible','On');
Fangjun Jiang
on 31 Aug 2011
In the code above, assume your listbox has option for 'x','y' and 'z', the panel name in the GUI is purposely named as xPanel, yPanel and zPanel to make it work.
When you design your GUI using GUIDE, you can make xPanel visible and put it at the desired position. Set the 'Visible' property of yPanel and zPanel to be 'Off' and put them at the outer of your GUI layout. Once your GUI design is done, you can re-size your GUI window to leave yPanel and zPanel at outside. In your GUI's OpeningFcn callback, you need to read in the postion of xPanel and assign them to the position of yPanel and zPanel. yPanel and zPanel are still invisible so won't cause problem. This way, when you choose different option from the listbox, the view of the different panel is seamlessly transitioned.
More Answers (1)
Yair Altman
on 10 Sep 2011
Matlab's built-in tab system is described in detail in the following articles:
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps 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!