Created
December 24, 2012 01:18
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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