Application Startup
Of models and Plugins
Smallworld Explorer
Transient Highlight
Map Rendering
Disable While Hidden
Custom Interaction mode (dragging cables)
Animation in the map
Transform Plugin
Including Additional Geometry
Look at the method transform_manager.check_source_geometries() to include additional geometries in the transform.
Blocking Prompter
The blocking_prompter exemplar allows you to display a GUI and wait for a response within the thread. It's great for one time question/answers. There are several built in varieties of prompt that allow you to do simple yes/no, options, or string test. You can add your own, just look at how the init code works and add your own gui components.
There are times when a blocking prompter does not work correctly. Mostly because it is run in a separate thread and some threading priorities may interfere. I'm not sure exactly when this happens, but basically the blocking prompter is locked and you can't do anything. Here is some code that gets around this issue. Thanks to Andy Meyers @ Sho-Me Power for allowing it to be posted… Concept from someone at GE…
SW5 NOTE: This is replaced with sw_message_dialog. A change similar to this may not work. Other situations using this approach seemed to cause a "thread hijack" error.
Application
Always Maximizing When Upon Start?
The very first time you start an application as a new User/ACE, the application seems to start maximized. If you don't resize and quit the first time, that setting appears to stay. To reset this, resize the application and run
swaf!.sys!perform(:|save_application_settings()|), where swaf! is the handle to the application. This seems to fix it.
Adding Shortcut Key
Application shortcut keys are great, but if not done right, you can loose that key in text boxes in the application. This example adds the backquote "‘" as a second shortcut key that switches the interaction mode. F12 is defined in the embedded_map_gui under accelerators and actually defines the key globally in the application which is ok because F12 isn’t a typical key used in text boxes. The other thing with F12 is that if you use the right hand for mouse control, F12 is on the right which isn't "quick".
Adding backquote as a shortcut key is actually simple. You need to add it to the <keyboard_interaction> element of the application config.xml file. Here is an example. There is no mode defined which allows the key to be used in any mode.
<plugin name="maps" class_name="map_manager">
<property name="render_priority" value="-30"/>
<property name="initial_interaction_mode" value="select"/>
<interaction_modes>
<mode name="select"/>
<mode name="geometry"/>
<mode name="zoom_in"/>
<mode name="zoom_out"/>
<mode name="pan"/>
<cycle_sequence modes="select,geometry"/>
</interaction_modes>
<keyboard_interaction>
<key id="delete_key" modifier="0" mode="select" action="delete_selection_with_confirmation"/>
<key id="delete_key" modifier="0" mode="select_pan" action="delete_selection_with_confirmation"/>
<key id="delete_key" modifier="0" mode="zoom_in" action="delete_selection_with_confirmation"/>
<key id="delete_key" modifier="0" mode="zoom_out" action="delete_selection_with_confirmation"/>
<key id="delete_key" modifier="0" mode="pan" action="delete_selection_with_confirmation"/>
<key id="back_quote" modifier="0" action="interaction_mode"/>
</keyboard_interaction>
</plugin>Then add back_quote to your application's MSG file like this
:back_quote `




