</R>Purpose<!R>
The histogram widget allows the programmer to create a histogram on the screen.
The histogram can be aligned either horizontally or vertically.
</R>Construction Options<!R>
A histogram widget is defined using the following syntax. The variable
</B>$histogramObject<!B> contains the reference to the histogram object.
$histogramObject = new Cdk::histogram ( options );
The options are defined in the following table.
</U>Option Default Value Type Purpose<!U>
Label Required Scalar The label which is attached to the histogram.
Height Required Scalar The height of the histogram.
Width Required Scalar The width of the histogram.
Orient Required Scalar The orientation of the object.
Lpos Left Scalar This is the position of the label in the histogram.
Xpos Center Scalar This is the position of the window on the X axis.
Ypos Center Scalar This is the position of the window on the Y axis.
Box True Scalar This Boolean states whether the dialog box will have a box drawn around it.
Shadow False Scalar This Boolean states whether the dialog box will have a shadow on the box.
</R>Available Methods<!R>
</B>set<!B>
Sets or resets certain attributes or features of the widget. The following
example demonstrates how to call the set method.
$histogramObject->set ( options );
The options are defined in the following table.
</U>Option Default Value Type Purpose<!U>
Low Required Scalar The low value of the histogram.
High Required Scalar The high value of the histogram.
Value Required Scalar The current value of the histogram.
Filler Space Scalar The fill character of the histogram.
Fillattr Reverse Scalar The attribute of the fill character.
Statspos Top Scalar The position of the statistics.
Sattrib Bold Scalar The attribute of the statistics.
Box True Scalar Draws the window with a box around it.
</B>draw<!B>
This method draws the object on the screen. The following example demonstrates
how to call the draw method.
$histogramObject->draw ( options );
The options are defined in the following table.
</U>Option Default Value Type Purpose<!U>
Box True Scalar Draws the window with a box around it.
</B>erase<!B>
This method removes the object from the screen. This does </B/U>NOT<!B!U>
destroy the object. The following example demonstrates how to call the erase
method.
$histogramObject->erase ();
</R>Tips & Tricks<!R>
<B=*>Try putting the statistics inside the histogram by setting the Statspos value to CENTER.
</B>raise<!B>
The raise method raises the widget to the top of the screen. This means if there
were any widgets obscuring part of the view, raising the object would bring the
complete object into view. The following example demonstrates how to call the
raise method.
$histogramObject->raise();
</B>lower<!B>
The lower method lowers the object so it doesn't obscure the view of any other
objects. The following example demonstrates how to call the lower method.
$histogramObject->lower();
</B>register<!B>
The register method registers the object to the default screen. This does </R>NOT<!R>
have to be called since the objects are registered automatically. This method
should be called if the </B>unregister<!B> method was called. The following
example demonstrates how to call the register method.
$histogramObject->register();
</B>unregister<!B>
The unregister method should be called when a widget, which is part of the
default screen, needs to be taken away temporarily. This does not delete or free
the object, it just unmaps it from any future screen refreshes. The object can
be registered by calling the </B>register<!B> method. The following example
demonstrates how to call the unregister method.
$histogramObject->unregister();
</B>getwin<!B>
This method returns a pointer to the window of the object. Not much use for this
yet. It will be useful in the future when the drawing methods are added. The
following example demonstrates how to call the getwin method.
$histogramObject->getwin();
</R>Physical Restrictions<!R>
None.
</R>Example Use Of The Widget<!R>
#!/usr/local/bin/perl
#
# Load in the Cdk Extension.
#
use Cdk;
Cdk::init();
# Create the histogram
my $histogram = new Cdk::Histogram ('Label' => "Loading CDK:",
'Height' => 2,
'Width' => 20,
'Orient' => "HORIZONTAL");
# Set the values.
for ($x=1; $x <= 100; $x += 2)
{
$histogram->set ('Low' => 1, 'High' => 100, 'Value' => $x,
'Statstype' => "PERCENT",
'Statspos' => "CENTER");
$histogram->draw ('Box' => "TRUE");
sleep (1);
}
# Exit Cdk.
Cdk::end();
<C><#HL(70)>
Document Created: June, 1995
Document Revised: November, 1995
Document Revised: March, 1996