Using the GUI Class

When a script is being run from within the Understand application, the Gui class becomes available. This class gives access to the current open database and information about the cursor position and current selection for the file being edited.

# This script is designed to run within the  
# Understand application 
use Understand; 
die "Must run within Gui" if !Understand::Gui::active(); 
die "Must run with db open" if !Understand::Gui::db(); 
 
my $db = Understand::Gui::db(); 
printf("Database: %s\n",$db->name()); 
my $filename = Understand::Gui::filename(); 
my $col      = Understand::Gui::column(); 
my $line     = Understand::Gui::line(); 
printf("File '%s' [%d,%d]\n",$filename,$line,$col)  
              if ($filename); 
my $entity = Understand::Gui::entity(); 
printf("Entity '%s'\n",$entity->name()) if $entity; 
my $selection = Understand::Gui::selection(); 
my $word = Understand::Gui::word(); 
printf("Selection '%s'\n",$selection) if $selection; 
printf("Word '%s'\n",$word) if $word; 

See Understand::Gui class for detailed information.


Scientific Toolworks, Inc.
http://www.scitools.com