Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes

.\

cgprogressbar__define.pro

Graphics


This program is used to draw a progress bar on the display.

The program requires the Coyote Library to be installed on your machine.

Examples

To display a progress bar in a program with a FOR loop:

cgProgressBar = Obj_New("CGPROGRESSBAR", /Cancel) cgProgressBar -> Start FOR j=0,9 DO BEGIN IF cgProgressBar -> CheckCancel() THEN BEGIN ok = Dialog_Message('The user cancelled operation.') RETURN ENDIF Wait, 0.5 ; Would probably be doing something ELSE here! cgProgressBar -> Update, (j+1)*10 ENDFOR cgProgressBar -> Destroy
An additional example can be found my compiling the program and typing this command:
IDL> ProgressBar_Example

Class description for cgProgressBar

Inheritance

Properties

Properties in cgProgressBar

XSIZE init
START init
YSIZE init
NOCANCEL init
XOFFSET init
YOFFSET init
CANCELBUTTON init
TITLE init
PERCENT init
TEXT init
GROUP_LEADER init

Fields

Fields in IDL_OBJECT

Fields in cgProgressBar

MODEL obj_new()
XSIZE 0L
MASK obj_new()
YSIZE 0L
VIEW obj_new()
WINDOW obj_new()
DRAWID 0L
CANCELID 0L
IMAGE obj_new()
TEXT obj_new()
LABELID 0L
TLB 0L

Author information

Author

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright

Copyright (c) 2012, Fanning Software Consulting, Inc.

History

Change History:

Written by: David W. Fanning, 27 September 2012. Inspired by Ronn Kling's program krProgressBar.

Routines

result = cgProgressBar::INIT( [/CANCELBUTTON] [, GROUP_LEADER=long] [, /NOCANCEL] [, PERCENT=float], START=START [, TEXT=string] [, TITLE=string] [, XOFFSET=int] [, XSIZE=int] [, YOFFSET=int] [, YSIZE=int])

Checks the cancel button to see if it has been selected.

cgProgressBar::CLEANUP

The clean-up routine for the object.

result = cgProgressBar::CheckCancel( [MESSAGE=string] [, /RESPOND])

Checks to see if a Cancel button has been clicked during the on-going operation.

result = cgProgressBar::CreateImage()

Create the object image for the program.

cgProgressBar::Destroy

Destroys the progress bar.

cgProgressBar::Update, percent

Updates the progress bar.

cgProgressBar::UpdateMask, percent

Update the image mask to reflect the correct percentage.

cgProgressBar::Start [, percent]

Starts the progress bar by realizing the progress bar on the display.

Progressbar_Example_Event, event

The event handler for the progress bar example program.

Progressbar_Example

This is an example program that illustrates how the cgProgressBar object can be used.

cgProgressBar__Define [, class]

The class definition module for the cgPROGRESSBAR object class.

Routine details

top cgProgressBar::INIT

result = cgProgressBar::INIT( [/CANCELBUTTON] [, GROUP_LEADER=long] [, /NOCANCEL] [, PERCENT=float], START=START [, TEXT=string] [, TITLE=string] [, XOFFSET=int] [, XSIZE=int] [, YOFFSET=int] [, YSIZE=int])

Checks the cancel button to see if it has been selected.

Return value

Returns a 1 if the user clicked the Cancel button and a 0 otherwise.

+ The initialization routine for the cgPROGRESSBAR object class.

Keywords

CANCELBUTTON in optional type=boolean default=0

Set this keyword if you wish to have a CANCEL button on the progress bar. If a CANCEL button is present, the user is reponsible for checking if the user has canceled while the progress bar is running.

GROUP_LEADER in optional type=long

The identifier of a group leader widget for the progress bar. If the group leader dies, the progress bar will be destroyed.

NOCANCEL in optional type=boolean default=1

A depreciated keyword, added for compatibility with the old Progressbar code. If set, sets the CancelButton keyword to 0.

PERCENT in optional type=float default=0.0

The initial percentage completion of the progress bar when it first appears on the display. Used only if the Start keyword is also set.

START
TEXT in optional type=string

The text that appears in a label widget above the progress bar. If not supplied, no label widget is created.

TITLE in optional type=string

The text that appears as the window title of the progress bar. By default, "Operation in Progress...".

XOFFSET in optional type=int

The X offset, in pixels, from the top-left corner of the display. If not provided, the progress bar is centered in the window.

XSIZE in optional type=int default=250

The X size, in pixels, of the progress bar.

YOFFSET in optional type=int

The Y offset, in pixels, from the top-left corner of the display. If not provided, the progress bar is centered in the window.

YSIZE in optional type=int default=25

The Y size, in pixels, of the progress bar.

top cgProgressBar::CLEANUP

cgProgressBar::CLEANUP

The clean-up routine for the object.

top cgProgressBar::CheckCancel

result = cgProgressBar::CheckCancel( [MESSAGE=string] [, /RESPOND])

Checks to see if a Cancel button has been clicked during the on-going operation. An optional response can be issued, if so.

Keywords

MESSAGE in optional type=string

If the RESPOND keyword is set, this is the message set in the blocking dialog widget. By default: "Current Operation Cancelled by User".

RESPOND in optional type=boolean default=0

If this keyword is set, the program responds to a positive cancel flag by destroying the progress bar and setting a blocking dialog widget for the user. The keyword is ignored if the cancel flag is zero.

top cgProgressBar::CreateImage

result = cgProgressBar::CreateImage()

Create the object image for the program. Taken from Ronn Kling's "really cool" background image in krProgressBar.

top cgProgressBar::Destroy

cgProgressBar::Destroy

Destroys the progress bar.

top cgProgressBar::Update

cgProgressBar::Update, percent

Updates the progress bar.

Parameters

percent in required type=float

The percent the progress bar has been completed. A number between 0 and 100. Forced into this range.

top cgProgressBar::UpdateMask

cgProgressBar::UpdateMask, percent

Update the image mask to reflect the correct percentage.

Parameters

percent in required type=float

The percent the progress bar has been completed. A number between 0 and 100. Forced into this range.

top cgProgressBar::Start

cgProgressBar::Start [, percent]

Starts the progress bar by realizing the progress bar on the display.

Parameters

percent in optional type=float

Starts the progress bar with this percentage completion. A number between 0.0 and 100.0.

top Progressbar_Example_Event

Progressbar_Example_Event, event

The event handler for the progress bar example program.

Parameters

event in required type=structure

The event structure.

top Progressbar_Example

Progressbar_Example

This is an example program that illustrates how the cgProgressBar object can be used.

top cgProgressBar__Define

cgProgressBar__Define [, class]

The class definition module for the cgPROGRESSBAR object class.

Parameters

class out optional type=structure

The object class definition as a structure. Occasionally useful.

File attributes

Modification date: Fri Mar 27 11:07:37 2015
Lines: 575
Docformat: rst rst