-1

I have a popup-menu that has an option, add own material, and when this is chosen, a pushbutton is enabled that say SAVE. I alose have a bunch of edit-boxes.

What I want to do is to make a callback so whenever I click the SAVE, the data from one of the textboxes will possible to select in the popupmenu. when this is selected, I want to set the other edit-boxes to contain the same data that they did when I clicked the save button.

Thanks in advance

4

1 回答 1

0

我不太确定完全理解您想要什么,但是您可以在按下按钮时使用弹出菜单的句柄来获取包含的字符串/字符串数组。然后,您也可以使用它们的句柄将它们放入文本框中。

例如:

MyStrings = get(handlesToYourPopupMenu,'String');

或者

MyStringsArray = cellstr(get(handlesToYourPopupMenu,'String'));

它包含作为单元格数组的弹出菜单的内容。

set(handlesToYourEditBox,'String',MyString);

你是这个意思吗?如果没有请询问:)

编辑:

要将新数据添加到文本框的现有内容中,请使用连接。由于内容位于元胞数组中,您可以执行以下操作:

新字符串 = [旧字符串 {当前字符串}];

其中 CurrentString 是通过

get(hanlesToYourEditBox,'String');

因此,要更新弹出菜单的内容,您可以这样写:

set(handlesToPopUpMenu,'String',[MyStringsArray {get(hanlesToYourEditBox,'String')}]):
于 2014-07-09T12:55:21.537 回答