</R>Purpose<!R>
The radio widget allows the programmer to create a radio list. The radio widget
acts very similar to the scrolling list. In fact the radio list is a scrolling
list, just with the extra feature of a visual selection.
</R>Construction Options<!R>
A radio widget is defined using the following syntax. The variable
</B>$radioObject<!B> contains a reference to the radio object.
$radioObject = new Cdk::Radio ( options );
The options are defined in the following table.
</U>Option Default Value Type Purpose<!U>
Title Required Scalar The title of the radio list.
List Required Array Ref The list of items in the list.
Height Required Scalar The height of the radio list.
Width Required Scalar The width of the radio list.
Choice X Scalar The choice character.
Cattr Normal Scalar The attribute of the choice character.
Default 0 Scalar The default item in the list.
Highlight Reverse Scalar The attribute of the currently highlighted item.
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>activate<!B>
Activation of an object means to make the object available for use. The
following example demonstrates how to activate a radio widget.
$returnValue = $radioObject->activate ();
The variable </B>$returnValue<!B> will contain a integer value representing
the number of the chosen item. The numbers start at zero and go up.
</B>set<!B>
Sets or resets certain attributes or features of the widget. The following
example demonstrates how to call the set method.
$radioObject->set ( options );
The options are defined in the following table.
</U>Option Default Value Type Purpose<!U>
Highlight Required Scalar The attribute of the currently highlighted item.
Choice Required Scalar The choice character.
Box True Scalar Changes the current value of the box flag.
</B>bind<!B>
The bind method binds keys to events. The binding is specific to the individual
objects. The following example demonstrates how to call the bind method.
$radioObject->bind ( options );
The options are defined in the following table.
</U>Option Default Value Type Purpose<!U>
Key Required Scalar This is the character to bind the event to.
Function Required Scalar This is the name of the callback function.
</B>draw<!B>
This method draws the object on the screen. The following example demonstrates
how to call the draw method.
$radioObject->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.
$radioObject->erase ();
</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.
$radioObject->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.
$radioObject->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.
$radioObject->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.
$radioObject->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.
$radioObject->getwin();
</R>Default Key Bindings<!R>
</U>Key Action<!U>
Up Arrow Moves the cursor to one item up.
Down Arrow Moves the cursor to one item down.
Tab Moves the cursor to one item down.
Right Arrow Scrolls the whole list one character to the right.
Left Arrow Scrolls the whole list one character to the left.
Previous Page Moves the complete list one screen backwards.
CTRL-B Moves the complete list one screen backwards
Next Page Moves the complete list one screen forwards.
CTRL-F Moves the complete list one screen forwards.
g Moves to the top of the list.
1 Moves to the top of the list.
G Moves to the bottom of the list.
$ Scrolls complete list as far left as possible.
| Scrolls complete list as far right as possible.
Space Selects the current item.
Return Exits the widget and returns the current selection.
CTRL-R Refreshes the screen.
</R>Tips & Tricks<!R>
<B=*>Setting the default value sets that value on when the radio list is
activated.
</R>Physical Restrictions<!R>
</U>Restriction Value<!U>
Maximum number of items. 500
</R>Example Use Of The Widget<!R>
#!/usr/local/bin/perl
#
# Load in the Cdk Extension.
#
use Cdk;
Cdk::init();
# Set up the radio list.
my @list = ("Item 1", "Item 2", "Item 3",
"Item 4", "Item 5", "Item 6",
"Item 7", "Item 8", "Item 9",
"Item 10", "Item 11", "Item 12");
# Create the radio list object.
my $testlist = new Cdk::Radio ('Title' => "<C></5>Radio List",
'List' => \@list,
'Height' => 10,
'Width' => 20);
# Activate the radio object.
@info = $testlist->activate ();
# Exit Cdk.
Cdk::end();
# Print out the info.
print "\n\n\n";
for ($x=0; $x < $#list; $x++)
{
print "Item #$x = '$info[$x]'\n";
}
sleep (5);
<C><#HL(70)>
Document Created: June, 1995
Document Revised: November, 1995
Document Revised: March, 1996