Hi Eric,
The example you cited from the SketchUp Blog has everything you need.
In the html of the WebDialog there is a button:
<input type="button" onclick="callRuby('pull_selection_count')" value="Refresh">
onclick is an event that is fired when the button is clicked. When the button is clicked, the Javascript function named callRuby is executed. The string value 'pull_selection_count' is passed to the callRuby function.
// Javascript in the html which defines the callRuby function used by onclick.
function callRuby(actionName) {
query = 'skp;get_data@' + actionName;
window.location.href = query;
}
callRuby shows how to pass a value from the WebDialog to the SketchUp plugin that created the dialog. The Ruby script needs a callback named 'get_data'.
window.location = 'skp:get_data@' + data;
skp: - not sure precisely what this does but is required for the callback,
get_data - the name of the call back in the ruby script, defined using add_action_callback('callbackname') { ... }
@ - Optional: If you need to pass values to the call back, you need this delimiter.
String concatenation in Javascript.
data - a Javascript String.
# The ruby part
my_dialog.add_action_callback("get_data") do |web_dialog, action_name|
UI.messagebox("Ruby says; Your javascript has asked for " + action_name.to_s)
end
The Ruby variable action_name get the value of the Javascript variable data.
Hope that helps a little.