class RtMeter PtBasic { meter_color; // color (Rt_ARG_METER_COLOR) meter_flags; // flag (Rt_ARG_METER_FLAGS) meter_font_color; // color (Rt_ARG_METER_FONT_COLOR) meter_increment; // integer (Rt_ARG_METER_INCREMENT) meter_key_left; // integer (Rt_ARG_METER_KEY_LEFT) meter_key_right; // integer (Rt_ARG_METER_KEY_RIGHT) meter_level1_color; // color (Rt_ARG_METER_LEVEL1_COLOR) meter_level1_pos; // short (Rt_ARG_METER_LEVEL1_POS) meter_level2_color; // color (Rt_ARG_METER_LEVEL2_COLOR) meter_level2_pos; // short (Rt_ARG_METER_LEVEL2_POS) meter_level3_color; // color (Rt_ARG_METER_LEVEL3_COLOR) meter_max_needle_position; // short (Rt_ARG_METER_MAX_NEEDLE_POSITION) meter_min_needle_position; // short (Rt_ARG_METER_MIN_NEEDLE_POSITION) meter_needle_color; // color (Rt_ARG_METER_NEEDLE_COLOR) meter_needle_position; // short (Rt_ARG_METER_NEEDLE_POSITION) meter_num_severity_levels; // short (Rt_ARG_METER_NUM_SEVERITY_LEVELS) meter_text_font; // string (Rt_ARG_METER_TEXT_FONT) }
This widget is a half-circle meter with an indicator needle and up to three different-colored pie-shaped arcs that mark three chosen ranges on the meter.
![]() | For detailed information, please refer to RtMeter in the Photon documentation. |
A number specifying the color used for the meter's center, outline, and tick marks. Default is 0x0 (black).
This instance variable controls characteristics of the widget, and may have one or two of the following values:
A number specifying the color for the display of minimum and maximum values. Default is 0x0 (black).
A number of units to move the needle when an assigned key is pressed.
A number or key name from PkKeyDef.lsp for the key that moves the needle to the left or right. Defaults are Pk_Left and Pk_Right. You can load the key name constants with a call to require_lisp("PkKeyDef.lsp").
A number specifying a color for the left arc of the meter that corresponds to Level 1. Default is 0x00ff00 (green).
A number specifying the end of Level 1, expressed as a percentage of the whole meter. Default is 50. This setting is unaffected by changes to meter_max_needle_position or meter_min_needle_position.
A number specifying a color for the center arc of the meter that corresponds to Level 2. Default is 0xffff00 (yellow).
A number specifying the end of Level 2, expressed as a percentage of the whole meter. Default is 75. This setting is unaffected by changes to meter_max_needle_position or meter_min_needle_position.
A number specifying a color for the right arc of the meter that corresponds to Level 3. Default is 0xff0000 (red).
A number specifying the maximum point on the meter, the maximum value for the needle to register.
A number specifying the minimum point on the meter, the minimum value for the needle to register.
A number specifying the color of the needle. Default is 0xffffff (white).
A number specifying the current position of the needle, within the range of meter_min_needle_position and meter_max_needle_position. The needle will remain at the maximum or minimum position for any value outside that range.
The number of arcs that the meter is divided into. The maximum number is 3, which is also the default.
A string specifying the font used for displaying the maximum and minimum values. Default is "helv10".
This example, ex_RtMeter.g, is included in the gamma_ph_#_examples_1_QNX4.tgz file available on the Cogent Web Site.
#!/usr/cogent/bin/phgamma
/*
* This example demonstrates an RtMeter.
*/
require_lisp("PhotonWidgets.lsp");
PtInit(nil);
function display_value(wnum, wmet)
{
wmet.meter_needle_position = wnum.numeric_value;
}
win = new(PtWindow);
win.SetArea(100, 100, 250, 200);
meter = new(RtMeter);
meter.SetArea(20, 40, 200, 200);
meter.meter_color = 0xccddff;
meter.meter_max_needle_position = 150;
meter.meter_min_needle_position = 0;
meter.meter_level1_color = 0x00ff00;
meter.meter_level1_pos = 50;
meter.meter_level2_color = 0xffff00;
meter.meter_level2_pos = 100;
meter.meter_level3_color = 0xff0000;
meter.meter_needle_position = 70;
meter.meter_needle_color = 0x000000;
num = new(PtNumericInteger);
num.SetArea(100, 150, 50, 20);
num.numeric_increment = 10;
num.numeric_min = 0;
num.numeric_max = 150;
num.numeric_value = 70;
num.numeric_flags = cons(Pt_NUMERIC_WRAP, nil);
num.numeric_flags = cons(Pt_NUMERIC_AUTO_HIGHLIGHT, nil);
PtAttachCallback(num, Pt_CB_NUMERIC_CHANGED, `display_value(@num, @meter));
display_value(num, meter);
PtRealizeWidget(win);
PtMainLoop();