Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / Using IDL / Tips on Creating Widget Applications

IDL

Tips on Creating Widget Applications

Tips on Creating Widget Applications

The following are some ideas to keep in mind when writing widget applications in IDL.

  • When writing new applications, decompose the problem into sub-problems and write reusable compound widgets to implement them. In this way, you will build a collection of reusable widget solutions to general problems instead of hard-to-modify, monolithic programs.
  • Use the GROUP_LEADER keyword to WIDGET_BASE to define the relationships between parts of your application. Group leadership/membership relationships make it easy to group widgets appropriately for iconization, layering, and destruction.
  • Use the MBAR keyword to WIDGET_BASE to create application-specific menubars. Use keyboard focus events to track which widget menu options should affect.
  • Use existing compound widgets when possible. In particular, use the CW_BGROUP and CW_PDMENU compound widgets to create menus. These functions are easier to use than writing the menu code directly, and your intent will be more quickly understood by others reading your code.
  • The many advantages of the XMANAGER procedure dictate that all widget programs should use it. There are few if any reasons to call the WIDGET_EVENT procedure directly.
  • Use CATCH to handle any unanticipated errors. The CATCH branch can free any pointers, pixmaps, logical units, etc., to which the calling routine will not have access, and restore IDL session-wide settings like color tables and system variables that were locally modified.
  • It can be difficult to write 100% portable widget code that looks good on all platforms, so let IDL do the layout for you when possible. If all else fails, it is possible to use the value of the WIDGET_INFO function to execute special-case code for each platform’s user interface toolkit. It is desirable, however, to avoid large-scale special-case programming because this makes maintenance of the finished program more difficult. See Portability Issues below for additional suggestions.
  • Use the BITMAP keyword to WIDGET_BASE to add a custom icon to your base widget (Windows platform only).

Portability Issues


Although IDL widgets are essentially the same on all supported platforms, there are some differences that can complicate writing applications that work well everywhere. The following hints should help you write such applications:

  • Avoid specifying the absolute size and location of widgets whenever possible. (That is, avoid using the XSIZE, YSIZE, XOFFSET, and YOFFSET keywords.) The different user interface toolkits used by different platforms create widgets with slightly different sizes and layouts, so it is best to use bases that order their child widgets in rows or columns and stay away from explicit positioning. If you must use these keywords, try to isolate the affected widgets in a sub-base of the overall widget hierarchy to minimize the overall effect.
  • When using a bitmap to specify button labels, be aware that some toolkits prefer certain sizes and give sub-optimal results with others.
  • Try to place text, label, and list widgets in locations where their absolute size can vary without making the overall application look bad. The fonts used by the different toolkits have different physical sizes that can cause these widgets to have different proportions.

It is reasonably easy to write applications that will work in all environments without having to resort to much special-case programming. It is very helpful to have a machine running each environment available so that the design can be tested on each iteratively until a suitable layout is obtained.



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us