Multi-level Event Handling

Multi-level Event Handling (Meh :-) is my Ruby-centric approach to handling user events. Relying on the speed of SketchUp's communication protocols, it performs only minimal activities (eg, show/hide content) in JavaScript. Further diminishing the need for custom JavaScript code, Meh relies heavily on jQuery and jQuery UI.

Any user activity which could affect the behavior of the plugin (eg, clicking a checkbox or a button) is forwarded to an appropriate Ruby callback. These are divided into two categories:

  • Actions, typically tied to links or buttons, cause the plugin to do something.

  • Updates, typically tied to checkboxes, radio buttons, tabs, or text areas, cause the plugin to record the new setting (eg, in a hash). In some cases (eg, tabs), they may also cause the plugin to perform an action (eg, call execute_script to add content to the tab).

This approach is used in all of my plugins that use WebDialogs, eg:

  • CFCL/Public: Draw Ruby 2 (ERb), Model Viewer

  • Igloo/Public: Product Editor, Report Maker


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r3 - 02 Jan 2012, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email