DOCUMENTATION

SYNOPSIS

PERL PROGRAM NAME: param_widgets
AUTHOR:  Juan Lorenzo

CHANGES and their DATES

DATE: V 1.0.1 May 6 2018

DESCRIPTION

manages the parameter labels, values and their
checkboxes in the mguis

USE

Examples

STEPS

NOTES

Declare local variables

private hash references

32 off

sub _max_length_in_gui

sub _set_length_in_gui

sub _reset

private reset of "condition" variables
do not reset incoming widgets

_changes

to only one parameter
some changes will be false and should be rejected

If you are at this subroutine it means that
a possible change has been detected in
the Entry Widget TODO: yet to be ratified

Currently if we reach this subroutine we assume that changes always occur to 
all parameters and so we 
forcibly check for changes always

changes are only allowed for those sunix programs whose spec files
have a max_index defined

currently changes in param_widgets package only works with regular flows 
and not with pre-built superflows

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 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 _set_index_on_entry

sub _update_check_button_setting

update for one parameter index 
in currently active program

Entry widget uses textvariables

sub set_check_buttons a widget reference

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

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,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 textvarible 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
 

sub set_current_program

used in main by
flow_select, 
sunix_select 
and delete_from_flow_button

sub set_first_idx

=0

sub set_labels_frame

a widget reference

sub set_length

override default length values

sub set_check_buttons_w_aref

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_location_in_gui

 set check_buttons by user from outside 
 
	     	foreach my $key (sort keys %$here) {
   			print (" param_widgets,set_location_in_gui, key is $key, value is $here->{$key}\n");
  		} 

sub set_labels

set labels by user from outside 

sub set_prog_name_sref set prog_name by user from outside

sub set_value4entry_button_chosen

assign value to  Entry Buttonchosen

   print("param is $entry_param;\n");
        print ("selected widget is # $LSU->{_parameter_value_index}\");
        print ("label is  $out\n");

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