DOCUMENTATION
SYNOPSIS
PERL PROGRAM NAME: param_widgets_green
AUTHOR: Juan Lorenzo
CHANGES and their DATES
DATE: V 0.0.1 May 6 2018
DESCRIPTION
manages the parameter labels, values and their
checkboxes in the guis
USE
Examples
STEPS
NOTES V 0.0.2 Sept. 24 2019 uses gui_history
Declare local variables
sub get_hash_ref
bring gui history parameters in to share
and update
# initialize default parameter values from gui_history
# needed herein
sub set_hash_ref
bring gui history parameters in to share
and update
_changes If you are at this subroutine it means that an Entry widget has lost or gained focus param_widgets_green, changes, If we reach this subroutine we will assume changes occurred to all parameter (Entry) widgets belonging to a program
We keep track of whether user is entering or leaving a
widget: _check_value_changes
changes are only allowed for those sunix programs whose spec files
have a max_index defined
currently changes in param_widgets_green package only works with regular flows
and not with pre-built superflows
index = parameter line index of the Entry widget in the flow
sub _check_value_changes
locate change index for Entry widget
off = 0
on = 1
Second case applies when we are using project_selector project_selector does not yet have a max_index defined in a separate module
sub _update_value_changes
locate change index for Entry widget
sub _error_check
When entry values are in error
sub get_check_buttons_w_aref
sub
sub get_entry_change_status
sub get_labels_w_aref
sub get_length_check_buttons_on
sub get_index_check_buttons_on
get_values_w_aref
return an array widget references
sub _max_length_in_gui
sub _set_length_in_gui
sub gui_full_clear
clear the gui completely of 61 parameter values 61 = current defaulted maximum number of variables in a list box
sub _set_entry_change_status
sub _update_check_button_setting
update for one parameter index
in currently active program
Entry widget uses textvariables
sub _set_index_on_entry
sub get_current_widget_name
screen location by using part of the widget name
print(" self:$self widget: $widget\n");
print(" currently focus lies in: $screen_location\n");
print(" reference: $reference\n");
foreach my $i (@fields) {
print(" 2. widget is $i\n");
my $screen_location = $widget->focusCurrent;
my $reference = ref $screen_location;
print(" 1. widget is $a\n");
print ( "widget is $fields[-1]\n");
name is in the last element of the split array
if widget_name= frame then we have flow
$var->{_flow}
if widget_name= menubutton we have superflow
$var->{_tool}
sub get_check_buttons_settings_aref
sub _get_check_buttons_settings_aref
sub get_entry_button_chosen_index
sub get_label4entry_button_chosen
determine which Entry Button is chosen
print("param is $entry_param;\n");
print ("selected widget is # $LSU->{_parameter_value_index}\");
print ("label is $out\n");
sub get_value4entry_button_chosen
determine which Entry Button is chosen
print("param is $entry_param;\n");
print ("selected widget is # $LSU->{_parameter_value_index}\");
print ("label is $out\n");
sub get_values_aref
all the values for one program at a time
from the parameter list in the GUI
sub get_labels_aref
equivalent to get_naems_aref
sub get_names_aref
equivalent to get_labels_aref
sub initialize_check_buttons
same set of check buttons for all programs
sub initialize_labels
sub initialize_values
sub range
establish the first and last
indices of the array
foreach my $key (sort keys %$ref_hash) {
print (" param_widgets_color,range, key is $key, value is $ref_hash->{$key}\n");
}
sub redisplay_check_buttons
update colors in check button boxes
sub redisplay_labels
print("1. redisplay, resdisplay_labels, text is @{$label_array_ref}[$i]\n");
print("redisplay, resdisplay_labels, i is $i\n");
print("2. redisplay, resdisplay_labels, text is @{$LSU->{_label_array_ref}}[$i]\n");
sub redisplay_values
display parameter values without quotes
although internally we always have quotes for strings
and no quotes if the value looks like a number
i/p: 2 array references
o/p: array reference
N.B. This is an ENTRY widget
textvariables must be a reference in order
for -validatecommand to work. BEWARE!
For the Entry widget do not alter the
textvariable directly while using
validatecommand but instead
indirectly delete the textvaribale and replace it using
the insert method
&_changes is invoked if
there is a new selection after an entry change
or even just if redisplay is selected
_changes returns a 0 to invoke an error check
In main, focus is forced to follows the mouse
so focus will change whenever mouse moves to a new
widget. That means the _changes will be invoked at every
shift of the mouse to a new widget.
use App::SeismicUnixGui::misc::control '0.0.3' to remove terminal quotes for values, only for display purposes;
when later read again the values will be given quotes if they
do not look like a number-- this occurs in a superclass
my $length = $param_widgets_color_href->{_length};
print("param_widgets_color, redisplay_values, length is $length\n");
sub set_check_buttons a widget reference
sub set_check_buttons_w_aref
sub set_current_program
used in main by
flow_select,
sunix_select
and delete_from_flow_button
sub set_first_idx
=0
sub set_focus_on_Entry_w
put focus on a widget Entry_w
sub set_index
sub set_labels_frame
a widget reference
sub set_length
override default length values
set_labels_w_aref
sub set_values_frame
a widget reference
set_values_w_aref
sub show_values
packing
sub set_check_buttons_frame
set check_buttons by user from outside
sub set_entry_change_status
sub set_labels
set labels by user from outside
sub set_prog_name_sref set prog_name by user from outside
sub set_value
set single value in widget array index required separately
sub set_values
set values by user from outside
sub show_check_buttons
packing
sub show_labels
specs come from local private variables
uses default specs, unless overwritten
specs are not fed from above
packing