From: Ramiro Massol on
hi
I'm using a jcombobox in the toolbar to enter new strings, each one identifying a group of settings for the GUI uicontrols. The purpose of this jcombobox is that the user can select a specific string and this will update a bunch of uicontrols in the GUI. The user can also modify the name of a selected string or enter a new one (jcombobox is editable). The major problem I have is that the callback that verifies the uniqueness of the string name and also stores it and resets the uicontrols is called twice instead of once.
My code is something like:

function test_OpeningFcn(hObject, eventdata, handles, varargin) %#ok<*INUSL>
hToolbar = findall(gcf,'type','uitoolbar');
jtb = get(get(hToolbar,'JavaContainer'),'ComponentPeer');
jcb = javax.swing.JComboBox({''});
jcb.setMinimumSize(java.awt.Dimension(20,150))
jcb.setMaximumSize(java.awt.Dimension(200,150))
jcb.setPreferredSize(java.awt.Dimension(115,150))
jcb.setToolTipText('Current Imaging System Group')
jcb.setEditable(1)
set(jcb,'SelectedItem','New Group Name Here')
set(jcb,'ActionPerformedCallback',@checkinputjcb);
jtb(1).add(jcb);
jtb(1).repaint;
jtb(1).revalidate;

function checkinputjcb(src,evnt)
disp('ads')

anybody knows how to prevent this callback to be called twice?
best
ramiro
 | 
Pages: 1
Prev: Using quad and unknown constants
Next: Linear Span