I made a callback function for an value_input field so that the beginning 0 was 
to disapere when an other value was entered.

Here i noticed that if the value_input would say 01..07 it was equal to the 
value 1..7. All good that far but if you enter 08 or 09 the value will still be 
0 if you read it and also the callback function wont be called.

Simple example code:



#include "input_field_ex.h"

Fl_Value_Input *my_input=(Fl_Value_Input *)0;

void modify_value(Fl_Value_Input*, void*){
        int a= my_input->value();
        my_input->value(1);//Trick compiler to not opimize code 
value(value(my_input))
        my_input->value(2);// trick compiler cont.
        my_input->value(a);
}

int main(int argc, char **argv) {
  Fl_Double_Window* w;
  { Fl_Double_Window* o = new Fl_Double_Window(475, 268);
    w = o;
    { my_input = new Fl_Value_Input(25, 25, 25, 25);
      my_input->maximum(50000);
      my_input->step(1);
      my_input->callback((Fl_Callback*)modify_value);
    } // Fl_Value_Input* my_input
    o->end();
  } // Fl_Double_Window* o
  w->show(argc, argv);
  return Fl::run();
}


Here default value is 0, enter 1 or 2 or .. 7 you will only see 7. Enter 8 or 9 
you will see 08 or 09. If you make an alert in the callback function you will 
see that it doesnt even get called for the last 2 cases.



_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to