ClassPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version

progress-indicator

Class

The class of the progress-indicator control.

Control

An instance of the progress-indicator class. This control often appears where users make a request on a form and will have to wait for some hidden process to complete before proceeding with the rest of the possible functions on the form.

Adding a progress-indicator control to your form

Click the progress-indicator tool on the Component toolbar. Move the mouse cursor to the part of the form where you want to place the control, and click again. The control will appear with colored resizing handles.

Resizing and moving the control

Controls can only be resized and moved on forms during the design stage; the size and location of everything is fixed on a running form.

Resize the control by clicking the mouse cursor and dragging one of the handles to the new size-point. Release the mouse key when you are satisfied with the new size.

Move the control by clicking anywhere on it except a resizing handle and dragging it to a new location on the form. Release the mouse key when you are ready to place the control.

Adding a caption to the progress indicator

  1. Select the static-text control tool.
  2. Click on the form and drag the control to the place where you want the caption for the progress-indicator to appear.
  3. Double-click the static-text control to focus on it with the Inspector.
  4. Inspect the title property of the control by double-clicking on the value of the title and changing it in the Edit Expression dialog. Click the OK button when you are done editing the new caption.

    If the caption is small enough to see in the Inspector's right column, you can also click once on the title and delete and replace the text right in the Inspector without opening the Edit Expression dialog.

  5. If you want to change the alignment of the text with respect to the length of the progress-indicator, resize the text control to be the exact same length as the progress-indicator. Then change the justification property of the text-control to either :right or :center. The initial justification on a static-text control is :left.

See About how to get sample code for creating controls in cgide.htm, which explains how to use the IDE to create such code.

Example

The following code creates a dialog window with a progress indicator on it. The variable my-pi is set to the component, using find-component. The function foo runs through a loop of length 10, printing the fraction done and updating the progress indicator in each iteration, while also sleeping for one second between loop interations. The progress indicator is incremented with (setf value).

(in-package :cg-user)
(make-window :pi-dialog
  :class 'dialog
  :interior (make-box-relative 100 100 240 140)
  :dialog-items
  (list (make-instance 'progress-indicator
          :left 20 :top 20 :width 200 :height 20
          :name :my-pi
          :value 0
          :range '(0 100)
          )))

(defvar my-pi)
(setq my-pi (find-component :my-pi :pi-dialog))

(defun foo ()
  (declare (special my-pi))
  (setf (value my-pi) 0)
  (dotimes (i 10)
    (sleep 1)
    (format t "~D% done~%" (* 10 (+ i 1)))
    (setf (value my-pi) (* 10 (+ i 1)))
    ))

A diagram of window and widget classes is shown in Widget and window classes in cgide.htm.


Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page was not revised from the 8.0 page.
Created 2009.7.29.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
Unrevised from 8.0 to 8.1.
8.0 version