'drawfreehand()' not working for lenovo touchscreen in appdesigner

2 次查看(过去 30 天)
I'm trying to setup a simple app in appdesigner that will let the user draw using a touchscreen with the drawfreehand() command. However the drawfreehand() command seems to be ignoring input from the touchscreen on my Lenovo X1 Yoga Gen 7, which is odd because I'm able to still click buttons and interact with the rest of the app using the touchscreen.
The app has a draw button, a clear button, and an axis to draw on as seen below.
To call the draw function, the draw button has the following "buttonPushed" callback
function DrawButtonPushed(app, event)
h = drawfreehand(app.UIAxes, 'Closed',0);
h.FaceSelectable = false;
h.HandleVisibility = 'off';
h.InteractionsAllowed = 'none';
h.Smoothing = 0;
h.FaceAlpha = 0;
end
And this seems to work, as long as I'm using the trackpad or a mouse. For some reason when I use the touchscreen with the thinkpad pen nothing happens. What's confusing me however is that if I remove the call to the UIAxes and instead try the following code:
function DrawButtonPushed(app, event)
h = drawfreehand('Closed',0);
h.FaceSelectable = false;
h.HandleVisibility = 'off';
h.InteractionsAllowed = 'none';
h.Smoothing = 0;
h.FaceAlpha = 0;
end
Then a new figure is generated in a seperate window and in that window the touchscreen works fine and I'm able to draw, however I'd prefer to keep the drawings on the same UI axis within the app.
I was curious if anyone else has run into problems with matlab apps working on a touchscreen and might have suggestions.
  2 个评论
Kevin Holly
Kevin Holly 2022-12-6
I have reproduced the issue. The touchscreen isn't working when axes/uiaxes are place on a uifigure, which App Designer uses. I have reported the issue to our development team.
This does not work:
fig = uifigure
ax = axes(fig)
drawfreehand(ax,'Closed',0);
This does:
fig = figure
ax = axes(fig)
drawfreehand(ax,'Closed',0);
Amal Raj
Amal Raj 2023-3-20
Hi,
I'm reposting your comment as an answer because it may be of assistance to others who are experiencing the same problem.

请先登录,再进行评论。

回答(1 个)

Amal Raj
Amal Raj 2023-3-20
I have reproduced the issue. The touchscreen isn't working when axes/uiaxes are place on a uifigure, which App Designer uses. I have reported the issue to our development team.
This does not work:
fig = uifigure
ax = axes(fig)
drawfreehand(ax,'Closed',0);
This does:
fig = figure
ax = axes(fig)
drawfreehand(ax,'Closed',0);

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by