How to improve GUI
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Fangjun Jiang
2011-8-30
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 个评论
Fangjun Jiang
2011-8-31
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
2011-8-31
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.
更多回答(1 个)
Yair Altman
2011-9-10
Matlab's built-in tab system is described in detail in the following articles:
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!