hello. We’re getting help from the community every time. After SketchUp is updated from version 2022 to version 2023, the function that worked well in 2022 has an error in 2023.
The main content is to execute the function, select an object with the mouse, the information of the selected object is expressed in HtmlDialog, and if the content is modified, the modified content is saved in the object. Immediately after the 2023 version update, UI::Inputbox has resolved the same symptom, but HtmlDialog has not yet been resolved. I wrote a test code and tested it, but I still can’t solve it. Should I wait for the next update?
I also wrote down the code that I tested.
Current SketchUp Version : 23.0.397 64-bit
module Ui_Test
module ButtonClickUI
class TestUi
def initialize
@ip = nil
end
def activate
@ip = Sketchup::InputPoint.new
end
def onMouseMove(flags, x, y, view)
@ip.pick view, x, y
end
def onLButtonDown(flags, x, y, view)
ph = view.pick_helper
ph.do_pick(x, y)
entity = ph.best_picked
if entity.is_a?(Sketchup::Group) then
html = getHtml()
dialog = UI::HtmlDialog.new({
:dialog_title => "Dialog Example",
:preferences_key => "com.sample.plugin",
:scrollable => true,
:resizable => true,
:width => 600,
:height => 400,
:left => 100,
:top => 100,
:min_width => 50,
:min_height => 50,
:max_width =>1000,
:max_height => 1000,
:style => UI::HtmlDialog::STYLE_DIALOG
})
dialog.set_html(html)
dialog.show_modal
end
end
def getHtml()
html = '''
<!DOCTYPE html>
<html>
<link href="vendor/modus/modus.min.css" rel="stylesheet">
<body class="m-3 bg-panel-background">
<form id="dlg-content-area">
<div class="form-group">
<label for="scale">Scale</label>
<input class="form-control" id="scale" placeholder="1:100">
</div>
<div class="form-group">
<label for="dpi">DPI</label>
<input class="form-control" id="dpi" placeholder="300">
</div>
</form>
</body>
</html>
'''
html
end
end
tool_menu = UI.menu("Tools")
tool_menu.add_item("HtmlUIClickTest") {
Sketchup.active_model.select_tool(TestUi.new())
}
end
end