- The HTML UI component is created in the figure and the content has fully loaded.
Initial value in uihtml + Javascript implementation of text input
2 次查看(过去 30 天)
显示 更早的评论
Since I got extremely helpful input on a previous question on this same general theme:
I thought I'd turn to you amazing people again.
In the attached .mlapp and .html files, the app simply asks for input in the top box and echos whatever is entered there in the bottom box. Nice and simple.
What I'd like to do is have an initial value appear in this box, sent over from MATLAB. In this code, I am trying two things out:
1) I try entering one string in the startupFcn, line 17
2) I try entering another string in the initial definition of the uihtml widget, line 53.
Neither string appears when the app is run.
When input is received in the app and is recorded in the bottom box, it simply echos to the screen (when run inside MATLAB) the state of the "event" variable. That shows that app.HTML.Data was correctly set in startupFcn, line 17, but that value is not being sent over to the Javascript or not triggering the DataChanged listener in the Javascript code.
The process of updating the text that appears in the upper box, using app.HTML.Data = ... works just fine elsewhere in the MATLAB code, like in line 29.
So it seems that a listener, either on the MATLAB or on the Javascript side, is not up and running when the app's startupFcn executes. Is there a way to set an initial value in the uihtml text edit box in the startupFcn, or at least before the app has started and is waiting for user input?
3 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!