matlab's GUI KeyPressFcn
4 ビュー (過去 30 日間)
古いコメントを表示
I am using the KeyPressFcn method for the edit box to test whether enter is pressed. I can use call_back but there is not event_data call_back function.
If I press one time on the button of Enter, than text doesn't rewrite, but if I double time on the button of Enter (speedly), than text rewrite.
What reasons this behaviour?
function WriteData(val, name, ind)
global solver;
switch ind
case {14, 15}
value = strcat('@(t)', val);
case 16
value = strcat('@(x)', val);
case {17, 18}
value = strcat('@(x,t)', val);
end
eval(strcat('solver.', name, ' = ', num2str(val) ) );
function edit1_KeyPressFcn(hObject, eventdata, handles)
val = get(hObject, 'String');
[~, ~, var] = GetActiveData(handles.listbox1);
ind = get(handles.listbox1, 'Value');
if (strcmp(eventdata.Key, 'return') )
WriteData(val, var, ind );
end
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!