Matthias Pospiech
Matthias Pospiech

Reputation: 3494

matlab popupmenu callback never called

I have a popupmenu called listBitDepth in my matlab gui.

I fill it with values using

bitDepthStr{1}= ' auto detect  '; mapBitDepthToListIndex(1) = 0;
bitDepthStr{2}= ' 8 bit   (256)'; mapBitDepthToListIndex(2) = 8;
bitDepthStr{3}= '10 bit  (1024)'; mapBitDepthToListIndex(3) = 10;
bitDepthStr{4}= '12 bit  (4096)'; mapBitDepthToListIndex(4) = 12;
bitDepthStr{5}= '14 bit (16384)'; mapBitDepthToListIndex(5) = 14;
bitDepthStr{6}= '16 bit (65536)'; mapBitDepthToListIndex(6) = 16;
set(handles.listBitDepth,'String',bitDepthStr); 
set(handles.listBitDepth,'value',1); 

which works.

And I have a callback function

function listBitDepth_Callback(hObject, eventdata, handles)
val = get(hObject,'Value')
...

which however is not called if I select an item from the list in the popup menu.

why?

Upvotes: 0

Views: 702

Answers (1)

grantnz
grantnz

Reputation: 7423

What do you get if you run the following after running to a break point after your code line set(handles.listBitDepth,'value',1); ?

get(handles.listBitDepth,'callback')

You should see:

ans =

@(hObject,eventdata)popuptest('listBitDepth_Callback',hObject,eventdata,guidata(hObject))

Upvotes: 1

Related Questions