Azzera filtri
Azzera filtri

Info

Questa domanda è chiusa. Riaprila per modificarla o per rispondere.

Using GUIDE, is there a way to preserve an element's property when copying/duplicating?

1 visualizzazione (ultimi 30 giorni)
Hi,
I have a panel with roughly 8 different elements in them (buttons, sliders, axes, edit boxes). Each of those elements has a tag with a set pattern, e.g. mute_button_1, or gain_slider_1. All of the elements has generic function (for callback, or creation, etc) which I wrote, e.g. @(hObject,eventdata)scp_gui('generic_mute_button_Callback',hObject,eventdata,guidata(hObject))
What I want to do is duplicate the panel 20 times. Each of the elements in the panel should have the exact same property except the tag and the location. The each tag will be different by incrementing the digitl, e.g. mute_button_2, or gain_slider_2 corresponds to the 2nd panel. The location is obviously different so the user can click on it, and this I will just change by dragging and dropping using GUIDE.
My problem is that when I try to copy and paste the panel, the tag property and all the callbacks are reset to default. The copied callback function, for example, is now %automatic and the tag is now edit11. Of course, I can just go through every single element and change it by hand. But I was wondering if there is a less tedious way to do this? At the very least, when copying elements, all the properties except the tag and the position are preserved.
(Note: Due to certain compatibility issues, I'm using Matlab 2014a instead of 20014b with the new HG2.) Thanks!
  1 Commento
Doug Hull
Doug Hull il 5 Gen 2015
This sounds like a very complicated UI. Do you think there might be a better way of doing what you are doing? Instead of 20 identical panels maybe a dropdown that switches which of the 20 you are dealing with? Maybe a slider? Putting that many identical panels on screen seems like a usability problem and will stress MATLAB when having those all there.
If you must do it this way, can you put panels on screen with a piece of code that is called 20 time with an input of where the panel is located?

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by