I remember this being an issue some versions back,… where html text created “on the fly” and then passed to UI::WebDialog#set_html would not work. (Like the issue reported here.)
If however the web dialog page was a local html file already, and then set using UI::WebDialog#set_file() it would work fine.
@dialog = UI::WebDialog::new(options_hash)
htmltext = "the html text for the dialog"
htmlfile = "flattext_dialog.html"
flattext_dir = File.dirname(__FILE__)
Dir::chdir(flattext_dir) {
File::write( htmlfile, htmltext, {:mode=>"w"} )
t = 0.25
i = 0
until File.exist?(htmlfile) || i == 5 # secs max
i += t
Kernel.sleep(t)
end
if File.exist?(htmlfile)
@dialog.set_file(htmlfile)
else
# write error message to log?
# Try set_html() again:
@dialog.set_html(htmltext)
end
}
# other code
# later delete the generated html file when the dialog is closed.
File.delete(File.join(flattext_dir,htmlfile))
If your on Mac, there might be multiple dialogs open, so the htmlfile names will need to be differenced.
I thought it was the initial release of v2014, and that it was fixed in 14M1 (Because [I think,] the bug was associated with the update to Ruby 2.0. I found my old “backquote” patch script in a “test” sub-folder of my 2014 “plugins” folder.)
I believe it was a MS Windows ONLY bug.
BTW, The API Release Notes page has not yet been updated for 16M1.