Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]

Building a Native IDL Application


A native IDL application contains only IDL code - it does not contain code written in other programming languages such as C or Visual Basic - and can be exported as a .sav file for distribution to other IDL users. This section describes the process of packaging an application written entirely in IDL for distribution.

Example Native IDL Application

The following example illustrates how native IDL applications are developed and distributed.

Create a .pro file

Enter the following in the IDL Editor, and save it as myApp.pro:

PRO done_event, ev 
; When the 'Done' button is pressed, exit 
; the application. 
 
WIDGET_CONTROL, ev.TOP, /DESTROY 
 
END 
 
PRO myApp 
 
; Read an image file. 
READ_JPEG, (FILEPATH('endocell.jpg', SUBDIRECTORY = $ 
   ['examples', 'data'])), image 
 
; Find the dimensions of the image. 
info = SIZE(image,/DIMENSIONS) 
xdim = info[0] 
ydim = info[1] 
 
; Create a base widget containing a draw widget 
; and a 'Done' button. 
wBase = WIDGET_BASE(/COLUMN) 
wDraw = WIDGET_DRAW(wBase, XSIZE=xdim, YSIZE=ydim) 
wButton = WIDGET_BUTTON(wBase, VALUE='Done', 
EVENT_PRO='done_event') 
 
; Realize the widgets. 
WIDGET_CONTROL, wBase, /REALIZE 
 
; Retrieve the widget ID of the draw widget. 
WIDGET_CONTROL, wDraw, GET_VALUE=index 
 
; Set the current drawable area to the draw widget. 
WSET, index 
 
; Display some data. 
TV, image 
 
; Call XMANAGER to manage the event loop. 
XMANAGER, 'myApp', wBase, /NO_BLOCK 
 
END 
Compile the Application

Select Compile from the Run menu to compile the .pro file.

RESOLVE_ALL

At the command line, enter the following to resolve all procedures and functions that are called in the application:

RESOLVE_ALL 
SAVE

At the command line, enter the following to save the compiled application as a .sav file:

SAVE, /ROUTINES, FILENAME = 'myApp.sav' 

The resulting .sav file is a stand-alone IDL application that can be run on any Windows, UNIX or Mac OS X computer containing the IDL Virtual Machine or a licensed copy of IDL. If you want your customers to run this application on a computer without IDL, you will need to include a runtime version of IDL with a runtime or embedded license in your application distribution.


Home | Categories | Alphabetical | Classes | All Contents | [ < ] | [ > ]