figure containing uihtml with dynamic content loses dynamic content when resized.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Dinesh
il 6 Feb 2024
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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!