Function works only in Debug Mode MATLAB GUI

醉酒当歌 提交于 2019-12-12 02:44:14

问题


I'm trying to create a calendar using MATLAB GUI. I found this tutorial and created calendar:

com.mathworks.mwswing.MJUtilities.initJIDE;
% Put calendar to my figure
jPanel = com.jidesoft.combobox.DateChooserPanel;
[hPanel,hContainer] = javacomponent(jPanel,[500,130,200,200],gcf);

set(handles.hPanel, 'MousePressedCallback', ...
   @(src, evnt)CellSelectionCallback(src, evnt, handles));
set(handles.hPanel, 'KeyPressedCallback', ...
   @(src, evnt)CellSelectionCallback(src, evnt, handles));

Also I have Edit Text object. Lets try to put Selected Value to it! I use excaza's code:

function CellSelectionCallback(hObject, evnt, handles)
hModel = handle(hObject.getSelectionModel, 'CallbackProperties');
selectedDate = hModel.getSelectedDate();
dayNumber = get(selectedDate,'Date');
handles.edit_start.String = num2str(dayNumber); 

handles.newNote(3) = {dayNumber};
guidata(handles.figure1, handles);

So I can read selected date and put it anywhere.

Problem

Code works only in Debug Mode. In normal mode my Edit Text Object (edit_start) stays empty!

来源:https://stackoverflow.com/questions/40374942/function-works-only-in-debug-mode-matlab-gui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!