Skip to content

Instantly share code, notes, and snippets.

@satrex
Created December 24, 2012 01:18
Show Gist options
  • Save satrex/4367009 to your computer and use it in GitHub Desktop.
Save satrex/4367009 to your computer and use it in GitHub Desktop.
Sample code for Trimble SketchUp web dialog component. Clicking button, javascript popup message appears. Clicking link, ruby popup message appears.
require 'Sketchup'
def show_dialog
dlg = UI::WebDialog.new("DialogTest", false,
"DialogTest", 200, 150, 150, 150, true);
html = <<-HTML
<form>
<input id="start2" onClick="window.alert('alert from javascript');" type="button" size="100" value="input">
</br>
<a href="skp:ruby_messagebox@from link">link</a>
</form>
HTML
dlg.set_html html
dlg.add_action_callback("ruby_messagebox") {|dialog, params|
UI.messagebox("You called ruby_messagebox with: " + params.to_s)
}
dlg.show
end
show_dialog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment