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) }
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.
![]() | For detailed information, please refer to RtProgress in the Photon documentation. |
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();
Copyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.