필터 지우기
필터 지우기

Add image (small icon) to text area in Appdesigner

조회 수: 3 (최근 30일)
elevonm
elevonm 2021년 8월 6일
댓글: elevonm 2021년 8월 23일
Hello,
I would like to create an app in the Appdesigner with multiple buttons (i.e. contacts). Upon clicking one of the buttons, the contact's name and address should appear. For this, I would like to add a small envelope icon in front of the adress.
The address itself is in a TextArea. I have tried
env = app.Image
env.ImageSource = 'envelope.png'
line1 = [env, 'address'].
The error I get is:
'Conversion to matlab.ui.control.Image from char is not possible.'
Would anyone have any advice?
Thanks is advance!
  댓글 수: 4
Paul Kaufmann
Paul Kaufmann 2021년 8월 6일
Might just be a workaround, but have you tried using the envelope-emoji instead of including a PNG image?
elevonm
elevonm 2021년 8월 6일
Thanks, but not actually trying to use envelope, just using this as an example...

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

채택된 답변

Harikrishnan Balachandran Nair
Harikrishnan Balachandran Nair 2021년 8월 20일
Hi,
From my understanding, you want to have an 'image' near your 'textarea' such that they are aligned. A possible workaround for this would be to have the image and textarea, both defined in the same figure handle. You can then position them accordingly, so that they are aligned. For example, to have the image to the right of text area, you can use the following code.
fig = uifigure;
im = uiimage(fig);
im.ImageSource = 'envelope.png';
txa = uitextarea(fig);
txa.Value='Address';
im.Position(1)=txa.Position(1)+txa.Position(3);
Alternatively, you can group together the text area and Image in the Design View,to modify them as a single unit, by using the Grouping Tool present in the Arrange Section of the toolstrip.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by