adime_d_double_calc_edit_proc (3) - Linux Manuals




#include <adime.h>

int adime_d_double_calc_edit_proc(int msg, DIALOG *d, int c);


Gui proc for an edit box accepting a mathematical expression whose result is a floating point number. The result is calculated and displayed on a separate gui object as the user types. The edit box has a 3d-ish look.

The dp2 field points to a `struct ADIME_EDIT_NUMBER *' which holds some information about the behavior of the edit box:

   typedef struct ADIME_EDIT_NUMBER
      int is_signed;          /* Set for integer formats if it is signed. */
      int is_float;           /* Set if we only have float, not double. */
      double min_val, max_val;/* Range for numbers. */
      DIALOG *result_object;  /* DIALOG object to display result in. */
The `result_object' will be used to display the result of the expression. There is an `adime_d_calc_edit_result_proc' object type which is designed to be used as `result_object', but you may of course write your own object to take care of this. Whenever the user changes the text in the `adime_d_double_calc_edit_proc', the result is printed to the `dp' field of `result_object'; hence you must have set the dp field of `result_object' to a text buffer with enough space (256 bytes is safe). The `result_object' will then be sent a `MSG_DRAW' message with the `c' parameter set to 2 if there is an error in the expression or 1 if it is ok.