RtProgress

RtProgress — A bar-style real-time progress indicator.

Synopsis

class RtProgress PtGauge
{
    progress_bar_color;    // color  (Rt_ARG_PROGRESS_BAR_COLOR)    
    progress_divisions;    // unsigned short  (Rt_ARG_PROGRESS_DIVISIONS)    
    progress_gap;          // unsigned short  (Rt_ARG_PROGRESS_GAP)    
    progress_spacing;      // unsigned short  (Rt_ARG_PROGRESS_SPACING)    
}
		

Base Classes

PtWidget <-- PtBasic <-- PtGauge <-- RtProgress

Description

This widget is a bar that fills with color from left to right to indicate progress from 0% to 100%. The colors can be changed, and the progress bar can be divided, with spaces put between the divisions.

[Note]

For detailed information, please refer to RtProgress in the Photon documentation.

Instance Variables

progress_bar_color

A number specifying the color of the progress bar. Default is 0xff0000 (red).

progress_divisions

A number specifying how many parts the bar is divided into. Default is 1. If divided into more than one part, the bar will not register a change in value until the entire part is complete. For example, a bar of 100 units divided into 10 parts whose value is 37 will show progress of 30 units. When the value reaches 40, the bar will show 40 units.

progress_gap

This variable is not currently implemented.

progress_spacing

A number of pixels specifying the separation between the parts, as divided by the progress_divisions variable above. The coloring of these spaces is the same as is set in the inherited fill_color variable

Example

This example, ex_PtNumeric-RtProgress.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
 * This example demonstrates PtNumeric and
 * PtProgress widgets.
 */

require_lisp("PhotonWidgets.lsp");
PtInit(nil);

function display_value(wnum, wprog)
{
  wprog.gauge_value = wnum.numeric_value;
}

win = new(PtWindow);
win.SetDim(160, 190);

ilab = new(PtLabel);
ilab.text_string = "Integer values";
ilab.SetArea(20, 6, 120, 20);
ilab.horizontal_alignment = Pt_CENTER;

inum = new(PtNumericInteger);
inum.SetArea(20, 30, 120, 20);
inum.numeric_increment = 5;
inum.numeric_max = 50;
inum.numeric_min = -50;
inum.numeric_value = 5;
inum.numeric_flags = cons(Pt_NUMERIC_WRAP, nil);
inum.numeric_flags = cons(Pt_NUMERIC_AUTO_HIGHLIGHT, nil);

if (_os_ == "QNX4")
     iprog = new(RtProgress);
else
     iprog = new(PtProgress);
iprog.SetArea(20, 60, 115, 20);
iprog.gauge_minimum = -50;
iprog.gauge_maximum = 50;

PtAttachCallback(inum, Pt_CB_NUMERIC_CHANGED, `display_value(@inum, @iprog));
display_value(inum, iprog);

if (_os_ == "QNX4")
{
  flab = new(PtLabel);
  flab.text_string = "Float values";
  flab.SetArea(20, 96, 120, 20);
  flab.horizontal_alignment = Pt_CENTER;
  
  fnum = new(PtNumericFloat);
  fnum.SetArea(20, 120, 120, 20);
  fnum.numeric_increment = 4.8941;
  fnum.numeric_max = 50;
  fnum.numeric_min = -50;
  fnum.numeric_value = 5.34153;
  fnum.numeric_precision = 4;
  fnum.numeric_flags = cons(Pt_NUMERIC_WRAP, nil);
  fnum.numeric_flags = cons(Pt_NUMERIC_AUTO_HIGHLIGHT, nil);
  
  fprog = new(RtProgress);
  fprog.SetArea(20, 150, 115, 20);
  fprog.gauge_minimum = -50;
  fprog.gauge_maximum = 50;
  fprog.progress_bar_color = 0x0000ff;
  PtAttachCallback(fnum, Pt_CB_NUMERIC_CHANGED, `display_value(@fnum, @fprog));
  display_value(fnum, fprog);
}

else
{
  lab = new(PtLabel);
  lab.SetPos(15, 90);
  lab.text_font  = "helv8";
  lab.text_string = string("Note: This example in QNX 4\n",
			   "also contains a PtNumeric Float \n",
			   "widget, which is not currently\n",
			   "available in Gamma/Photon for\n",
			   "QNX 6.");
}

PtRealizeWidget(win);
PtMainLoop();