Tk::SourceCatalog - creates a self-standing sources catalog widget
use Tk::AstroCatalog; $cat = new Tk::AstroCatalog($MW, $addCmd, $upDate, $onDestroy);
Tk::AstroCatalog creates a non-editable text widget, displaying sources from a default catalog or user-selected catalog file.
Methods available in this class:
Create a new Tk::AstroCatalog object. A new catalog object will be created. Callbacks must be specified for -addCmd and -upDate; a warning is issued for -onDestroy when it is missing.
$cat = new Tk::AstroCatalog($MW, -addCmd => $addCmd, -upDate => $upDate, -onDestroy => $onDestroy);
Additionally a pre-existing Astro::Catalog object can be supplied using the "-catalog" option.
$cat = new Tk::AstroCatalog($MW, -addCmd => $addCmd, -upDate => $upDate -catalog => $cat, );
The "-transient" option can be used if only a single value is required from the widget. Default behaviour is for the widget to be permanent. The "-transient" button does not have a "Done" button on the screen (ie no button to close the window without a selection)
The "-addCmd" callback is triggered whenever a source is selected from the widget. If the widget is transient the widget will be closed after the first add is triggered.
The "-onDestroy" callback is triggered when the "Done" button is pressed.
The "-upDate" method is triggered whenever the contents of the catalog widget are refreshed/updated.
It makes more sense for this widget to work like Tk::FileSelect when used in transient mode since we want to get the answer back rather than enter an event loop.
returns and sets the name of the Astro::Catalog
$catalog = $cat->Catalog(); $cat->Catalog('Default');
returns and sets the AddCommand callback code for the catalog
$addCommand = $cat->AddCommand(); $cat->AddCommand($addCommand);
returns and sets the UpDate callback code for the catalog
$update = $cat->UpDate(); $cat->UpDate($update);
Called whenever the contents of the text widget are redisplayed. The first argument will be the current object.
returns and sets the onDestroy callback code for the catalog
$reset = $cat->Reset(); $cat->Reset($reset);
returns and sets the name of the Toplevel
$toplevel = $cat->Toplevel(); $cat->Toplevel($top);
returns and sets whether the widget should be destroyed after the next Add.
$toplevel = $cat->Transient(); $cat->Transient($top);
returns and sets the name of the Text
$text = $cat->Text(); $cat->Text($text);
Configure the text displayed in the reference label widget. Usually a summary of the reference position.
Returns a reference to a scalar that can be used to associate the value with a widget.
returns and sets the name of the CatClass
$class = $cat->CatClass(); $cat->CatClass($class);
returns the Selected array or the indexed value of this array
@selected = $cat->Selected(); $value = $cat->Selected($index);
returns and sets the File name
$file = $cat->file(); $cat->file($filename);
makeCatalog creates a window that displays the contents of a catalog and allows the user to select as many entries as the user wishes.
$catalog = $cat->makeCatalog(); $catalog = $cat->makeCatalog($selected);
Remove the widget from display. Leaves calling the Reset handler to the DESTROY method.
Object destructor. Triggers when the object is destroyed. Guarantees to destroy the Toplevel widget and does trigger the onDestroy callback.
fills a text widget with the list of current sources
$cat->fillWithSourceList(); $cat->fillWithSourceList($text,$selected,$task,$index); $cat->fillWithSourceList($text,$selected,$task); $cat->fillWithSourceList($text,$selected);
Also triggers the UpDate method.
returns a color from @COLOR_LIST and increments the latter's index
$color = $cat->color();
Displays an error message in Tk
inswt inserts text into a given text widget and applies one or more tags to that text. Parameters: $text - Text to insert (it's inserted at the "insert" mark) $args - One or more tags to apply to text. If this is empty then all tags are removed from the text. $cat->inswt($text, $args);
getSource prompts the user to enter source coords and name Can specify previous source object to edit.
$obj = $cat->getSource(); $obj = $cat->getSource($source);
isWithin returns a boolean value as to whether an element is within the array specified. $obj = $cat->isWithin($element, @array);
Removes the item passed from the array specified. $obj = $cat->remove($element, @array);
Copyright (C) 1999-2002,2004 Particle Physics and Astronomy Research Council. All Rights Reserved.
Major subroutines and layout originally designed by Casey Best (University of Victoria) with modifications to create independent composite widget by Tim Jenness and Pam Shimek (University of Victoria)
Revamped for Astro::Catalog by Tim Jenness.