How to improve GUI

1 vue (au cours des 30 derniers jours)
Camilo Andrés Roca Duarte
Camilo Andrés Roca Duarte le 29 Août 2011
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

Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 30 Août 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 commentaires
Fangjun Jiang
Fangjun Jiang le 31 Août 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
Fangjun Jiang le 31 Août 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.

Connectez-vous pour commenter.

Plus de réponses (1)

Yair Altman
Yair Altman le 10 Sep 2011

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by