figure containing uihtml with dynamic content loses dynamic content when resized.
조회 수: 1 (최근 30일)
이전 댓글 표시
It looks like the figures autoresize resets the innerHTML of a web page running inside uihtml.
After resizing the figure returns to its initial state (at start-up).
This demostrates the problem, click the button in the figure, then resize the figure.
Test.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example of error</title>
</head>
<body>
<button onclick="TestCode()">Click for dynamic content</button>
<div id="div1">
<div/>
<script>
function TestCode() {
const para = document.createElement("h1");
const node = document.createTextNode("Some Content Here.");
para.appendChild(node);
const element = document.getElementById("div1");
element.appendChild(para);
}
</script>
</body>
</html>
function init()
uifig = uifigure("Name", "UI Window", "WindowStyle","normal",'NumberTitle','off');
uifig.Position = [500 500 1000 445];
uiView = uihtml(uifig);
uiView.Position = [10 10 980 420];
uiView.HTMLSource = "Test.html";
end
댓글 수: 0
채택된 답변
Dinesh
2024년 2월 6일
Hi Antony.
I'm unable to reproduce this behavior in R2023a.
Figure on startup:
Figure after clicking on the button 3 times:
Figure after resizing the window:
In your case, as I understand it, the dynamic content that was added disappears when the window resizes. Please let me know if my understanding is incorrect.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!