14.3. GTK: Editing Queries - .change_int, allow_entry_values, .assign_values

This method of the InterpolatorSettings class responds to a button click using the abstracted method .switched_on.

   /*--------------------------------------------------------------------
    * Method:      InterpolatorSettings.change_int
    * Returns:     t or nil
    * Description: Responding to a click on a "Choose an Interpolator"
    *              radio button, this method calls the allow_entry_values() 
    *              function on the active button.  The callback is set up 
    *              in qry_radio_but().
    *------------------------------------------------------------------*/
   method InterpolatorSettings.change_int(button, str, w1, w2, w3, e1, e2, e3)
   {
     if (button.switched_on())
       {
         .fn = str;
         allow_entry_values(w1, w2, w3, e1, e2, e3);
       }
   }
   
   /*--------------------------------------------------------------------
    * Function:    allow_entry_values
    * Returns:     t or nil
    * Description: Sets the three optional parameter entry widgets
    *              (X history, Time Interval, and Max. gap) sensitive or
    *              non-sensitive.  Called by qry_radio_but() and
    *              InterpolatorSettings.change_int().  The possible values
    *              for e1 - e3 are 0 (FALSE) or 1 (TRUE).
    *------------------------------------------------------------------*/
   function allow_entry_values(w1, w2, w3, e1, e2, e3)
   {
     w1.set_sensitive(e1);
     w2.set_sensitive(e2);
     w3.set_sensitive(e3);
   }
   

The .assign_values method is called by send_query to get the current values from the InterpolatorSettings class before actually sending a query. It uses the common function assign_history to assign the y_history and x_history.

   /*--------------------------------------------------------------------
    * Method:      InterpolatorSettings.assign_values
    * Returns:     t or nil
    * Description: Assigns the values from the interpolator entry widgets
    *              to the appropriate instance variables of the class.
    *              Called by send_query().
    *------------------------------------------------------------------*/
   method InterpolatorSettings.assign_values(e1, e2, e3, e4, e5, e6)
   {
     .y_history = assign_history(.dbflag, .y_history, e1.get_text());
     .start = number(e2.get_text());
     .duration = number(e3.get_text());
     .x_history =  assign_history(.dbflag, .x_history, e4.get_text());
     .interval = number(e5.get_text());
     .max_gap = number(e6.get_text());
   }