DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2399 Version: 1.1.10 Hi, I've ran into trouble while I wanted to use an Fl_Repeat_Button, and editing it's 'handle' function as well. In this following example the repeat button's callback writes the current position of the cursor to a file. - If the handle function is present (using the example as it currently is), the callback function will be called only after releasing the button, like a normal button (writing only one coordinate-pair to the file). - If the handle function is commented out the repeat button will be functioning normally, calling the callback function more times while it's held down (writing many coordinate-pairs to the file). #include <FL/FL.H> #include <FL/Fl_Window.H> #include <FL/Fl_Repeat_Button.H> #include <iostream> #include <fstream> using namespace std; // The global callback function, it writes the current mouse coords to "out.txt" void cb(Fl_Widget* w, void* v) { fstream f; f.open("out.txt",ios::app); f << Fl::event_x() << ", " << Fl::event_y() << endl; f.close(); } // The Repeat_Button class class MyRep : public Fl_Repeat_Button { public: MyRep(int x, int y, int w, int h) : Fl_Repeat_Button(x,y,w,h) { callback(cb); } // If this is commented out, everything's fine int handle(int e) { return Fl_Button::handle(e); } }; // The Window class class MyWin : public Fl_Window { public: MyRep* R; MyWin(int w, int h) : Fl_Window(w,h) { R = new MyRep(20,20,100,100); end(); show(); } }; int main() { MyWin *MW = new MyWin(300,200); return(Fl::run()); } I am really looking for a workaround to use both the handle, and the callback part of the repeat button. Thanks! -katz Link: http://www.fltk.org/str.php?L2399 Version: 1.1.10 _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
