PtScale

PtScale — A marked scale.

Synopsis

class PtScale PtGauge
{
    scale_flags;                  // flag
    scale_font;                   // string
    scale_major_tick_color;       // color 
    scale_major_tick_division;    // short 
    scale_major_tick_length;      // short 
    scale_minor_tick_color;       // color 
    scale_minor_tick_division;    // short 
    scale_minor_tick_length;      // short 
}
		

Base Classes

PtWidget <-- PtBasic <-- PtGauge <-- PtScale

Description

This widget is a horizontal or vertical scale that features major and minor ticks.

[Note]

This widget does not appear in the Photon documentation.

Instance Variables

scale_flags

This instance variable specifies the general features of the scale, and may be a combination of zero or more of the following flags:

ConstantDescription
Pt_SCALE_HORIZONTALThe scale is oriented horizontally.
Pt_SCALE_VERTICALThe scale is oriented vertically.
Pt_SCALE_REVERSEThe max and min values of the scale are reversed.
Pt_SCALE_DRAW_TOP_LINEDraw Top Line
Pt_SCALE_LABELA label is associated with the scale.

scale_font

A string specifying the font of the label.

scale_major_tick_color

A number specifying the color of the major tick marks. Default is 0x0 (black).

scale_major_tick_division

An integer specifying into how many equal-sized major parts the scale should be divided into. Default is 5.

scale_major_tick_length

A number of pixels specifying the length of the major tick marks. Default is 10.

scale_minor_tick_color

A number specifying the color of the minor tick marks. Default is 0x0 (black).

scale_minor_tick_division

An integer specifying into how many equal-sized minor parts each major division should be divided into. Default is 3.

scale_minor_tick_length

A number of pixels specifying the length of the minor tick marks. Default is 5.

Example

This example, ex_PtScale.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
 * This example demonstrates two PtScales, one using
 * user_defined values for instance variables, the other
 * with default values.  The PtScale widget is only
 * available in QNX 4.
 */

if (_os_ == "QNX6")
     princ ("\nThis widget is not available for QNX 6.", "\n\n");
else
{ 
  require_lisp("PhotonWidgets.lsp");
  PtInit(nil);
  
  win = new(PtWindow);
  win.SetDim(300,300);
  
  scl = new(PtScale);
  scl.SetArea(20,25,50,250);
  scl.fill_color = 0xffffaa;
  scl.scale_flags = Pt_SCALE_VERTICAL;
  scl.scale_font = "helv12";
  scl.scale_major_tick_color = 0xff0000;
  scl.scale_major_tick_division = 10;
  scl.scale_major_tick_length = 15;
  scl.scale_minor_tick_color = 0x0000ff;
  scl.scale_minor_tick_division = 5;
  scl.scale_minor_tick_length = 6;
  
  scldeflt = new(PtScale);
  scldeflt.SetArea(80,25,200,20);
  
  PtRealizeWidget(win);
  PtMainLoop();
}