필터 지우기
필터 지우기

Keyboard interaction with multiple windows opened on GUI

조회 수: 2 (최근 30일)
Emanuele Gandola
Emanuele Gandola 2015년 12월 1일
댓글: Emanuele Gandola 2015년 12월 1일
Hallo, I have a GUI with multiple functions and with it I can open any images in other "figure" windows. This is the GUI that is named figure1
I can upload images and put links into the list box and execute them one by one. The execute button contains this instruction to run a main function that perform the measurements of the objects present in the figure and show the result on a separate figure.
X = imread(char(Selected_images(Nimg,1)));
fig1 = figure(1);
imageHandle = imshow(X);
%get(fig1, 'WindowKeyPressFcn')
[stats,L,B] = master( Selected_images, path, lengthT,minarea,resolution,X,Nimg);
delete(h);
This is a tipical image
I've been implemented green buttons to keep informations into the images previously opened. For example the mouse position on click on that image.
I've also been implemented with this code keyboard interactions to create shortcut to select the pushButton callback whidhout clic on it.
function figure1_WindowKeyPressFcn(hObject, eventdata, handles)
switch eventdata.Key
case '1'
specie1_Callback(hObject, eventdata, handles)
case '2'
specie2_Callback(hObject, eventdata, handles)
case '3'
specie3_Callback(hObject, eventdata, handles)
case '4'
specie4_Callback(hObject, eventdata, handles)
case '5'
specie5_Callback(hObject, eventdata, handles)
case '6'
specie6_Callback(hObject, eventdata, handles)
case '7'
specie7_Callback(hObject, eventdata, handles)
case '8'
specie8_Callback(hObject, eventdata, handles)
case '9'
specie9_Callback(hObject, eventdata, handles)
end
I'd like to use these key interaction even when an image on figure is highlited and the main windows is in backgroud. Is it possible?
I've also another problem, when I want to set up different values into the text boxes an alert message incoming probably linked with WindowKeyPressFcn function.
Thanks in advance! Emanuele

채택된 답변

Walter Roberson
Walter Roberson 2015년 12월 1일
Only the current active figure has its keyboard callback checked.
You can set the same callbacks for all of the figures.
  댓글 수: 1
Emanuele Gandola
Emanuele Gandola 2015년 12월 1일
Perfect, can you suggest me where can I put the WindowKeyPressFcn function for the new figure created? Thanks a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Desktop에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by