How to link to a web address or a local PDF file from App designer?

조회 수: 15 (최근 30일)
I am adding a small help section to my app including some additional information about the product and how to use it. To do so, I need to learn:
1 - How to assign a hyperlink to text so that the assigned web address is opened in a browser?
2 - How to link to a local PDF file so that it is opened in a PDF reader once the user clicks on it? Let's assume we have a help file in PDF format, in the same directory of the application.
Thanks in advance.

채택된 답변

Pranjal Priyadarshi
Pranjal Priyadarshi 2019년 2월 18일
편집: Pranjal Priyadarshi 2019년 2월 18일
In order to assign a hyperlink to a component so that the assigned web address is opened in browser, we can add callback functions with the component being used in the AppDesigner in the manner shown below:
function ClickforHyperLinkButtonPushed(app, event)
%Anyone of the below commands can be used.
dos('explorer http://www.facebook.com'); % This will open the mentioned URL in new tab in Internet Explorer.
web('http://www.facebook.com'); % This will open the URL in the help browser of MATLAB.
end
This callback can be used for opening a file
function ClickForPDFButtonPushed(app, event)
dos('explorer file:/// FILE_PATH');
end
  댓글 수: 2
Farzam Malmir
Farzam Malmir 2019년 2월 20일
편집: Farzam Malmir 2019년 2월 20일
Thank you Pranjal. So it means I have to define a separate button to make a callback function for hyperlink, right? Isn't there any way to assign a hyperlink to a part of my text box like the way we do in text editors like Word?
Based on the code you listed, I also tried to use a "contact us" button so that by a click, the default email manager, let's say Outlook, opens with the developer's email address listed automatically in the receiver text box. However, neither of the following codes work. Please also help me with this.
dos('mailto:example@gmail.com')
or
dos('explorer mailto:example@gmail.com')
Pranjal Priyadarshi
Pranjal Priyadarshi 2019년 2월 22일
편집: Pranjal Priyadarshi 2019년 2월 26일
To answer the first question: I don't think anything of that sort is available in app designer.
To answer the second question: For sending email using the default email manager you can use the following callback. [For this to work you should have email manager installed on your windows machine (e.g. Outlook on Windows machine )]
email = 'myaddress@provider.ext';
url = ['mailto:',email];
web(url,'-browser')

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by