I have many panels, tables, buttons in the same GUI and it looks messed up. How can I deal with it?

2 visualizzazioni (ultimi 30 giorni)
I have a bunch of panels, push buttons and tables in the same GUI. I have overlapped most of them to save the space by using the visibility function.
But this doesn't workout sometimes during the execution and I see some panel invisible. Is it better to create a new window with another GUI? If so, how to combine this two GUI? (Remember I need to come back to the same old window after executing few parts in the new window)
Any Answers or Suggestions, Please help me. Thanks!

Risposta accettata

Adam Danz
Adam Danz il 4 Ago 2018
Modificato: Adam Danz il 6 Ago 2018
Welcome to the world of user interface design :) Sharing a screen shot of your GUI might help with suggestions but here are some basic ideas to consider.
Don't clutter the GUI. One way to control that is by properly using panels and the 'visible' property which seems to be your strategy. Each panel should contain components that are grouped strategically so that you can turn all of them off or on by setting the visible propery of the panel. If a button interacts with components from >1 panel, that button should be independent from any panel. Buttons can be small if their string is short (which it should be) so they don't take up much space. If you have more than 2-3 panels, managing their visibility could become difficult.
Another option is to break up the GUI into >1 GUI. For example, pressing a button may open a 2nd GUI that contains additional components. This option is safer if you've got lots of panels. The (solvable) problem is that handles from GUI-2 are not included in the 'handles' list in GUI-1. When you initialize the GUI-2 named "myGUI_2",
g2handle = myGUI_2;
g2handle will be the handle to myGUI2 and you can access all of the myGUI_2 components through that handle. However, once the callback function for the button press is complete, you lose g2handle.
To get the handle to myGUI_2 from other places in GUI_1, use findobj() and the 'name' property of myGUI_2 to get the handle. This assumes that no other object has that name. You could additionally use the 'tag' property to be even more specific.
g2handle = findobj('name', 'myGUI_2');
g2handle = findobj('name', 'myGUI_2', 'tag', 'additionalStuff')
Now, to get the handles to all of the components of myGUI_2 that have non-empty tags, use guihandles(). Be sure the component you're searching for has a unique tag which can be set from the GUIDE property editor or by using the set(handle,'tag','myUniqueTag') function.
hAll = guihandles(g2handle)
hAll will be a structure with a field for each component in myGUI_2. So if a table is named 'dataTable', access the data with
hAll.dataTable.Data
  7 Commenti
Adam Danz
Adam Danz il 6 Ago 2018
I don't know where in your GUI_1 you'll need data from GUI_2. For example, you might have a callback function that requires getting data from a different GUI that's opened. Those three lines of code can be put anywhere to find the opened GUI, search for its handles, and get data from any component in the opened GUI. Anytime you want to access a GUI from outside of the GUI's code, use those three lines.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by