필터 지우기
필터 지우기

How to use WindowKeyPressFcn while brush tool is active

조회 수: 5 (최근 30일)
Eric Snyder
Eric Snyder 2020년 2월 1일
댓글: Eric Snyder 2020년 2월 3일
I have built a GUI using GUIDE which allows users to select datapoints with the brush tool, and click a push button to assign a label to the selected data. I want to also allow users to press a key on the keyboard to assign a label to the selected data, but the WindowKeyPressFcn callback only works if the brushing tool is not selected. Is there a workaround for this, or another way to take input from the keyboard while the brush is active? The goal was to speed up the process by not requiring users to move the cursor between the plot and the push buttons as much, so a solution which requires users to click somewhere else (i.e. the command line or the brush icon) before pressing a key wouldn't be very useful. Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2020년 2월 1일
There is a hack that can permit it. I invented one and posted it a number of years ago, but a different version was required for hg2 in R2014b and later. The adjusted version by Yair is posted at undocumentedmatlab.com
  댓글 수: 2
Eric Snyder
Eric Snyder 2020년 2월 3일
This worked! I used the lines:
hManager = uigetmodemanager(hFig);
[hManager.WindowListenerHandles.Enabled] = deal(false); % HG2 (on 2014b or later)
set(hFig, 'KeyPressFcn', @myKeyPressCallback);
Thank you!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by