Monitor key press while editing text description in figure

4 views (last 30 days)
Hi everybody,
In my figure, I am inserting a text, which is editable after clicking on it:
TextObject = text(0.5,0.5, 'Please edit this text', 'ButtonDownFcn', @ClickActionText)
function ClickActionText(Source, Event)
fprintf('Text clicked!\n')
set(Source, 'Editing', 'on');
end
Now, I want to monitor the keys pressed during editing the textbox. Actually, I'd like to exit the editing mode by pressing enter - instead of clicking somewhere else in the figure or pressing ESC.

Answers (1)

Jan
Jan on 6 Apr 2021
This is not possible with the 'Editing=on' method. Use an edit field instead.
  1 Comment
Sven Holtje
Sven Holtje on 6 Apr 2021
Edited: Sven Holtje on 6 Apr 2021
Thanks for the quick response. I was trying out a lot of different stuff, and was already suspecting that this might not be possible at all.
Unfortunately an "edit field" UI component is missing functionaility and properties of the "text" description, and is therefore no alternative.

Sign in to comment.

Categories

Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!