From 30800d35d439194502a7134f262b8db5caceeeb3 Mon Sep 17 00:00:00 2001 From: Fabien Costantini Date: Sun, 5 Oct 2008 23:10:33 +0000 Subject: [PATCH] STR#2052 fixed. Also added documentation to FL_File_Input explaining what events the user can handle and also an application note explaining how to avoid potential callback reentrant calls. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6386 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_File_Input.H | 11 +++++++++-- src/Fl_File_Input.cxx | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/FL/Fl_File_Input.H b/FL/Fl_File_Input.H index 8e32a9e67..fcf3fdaf8 100644 --- a/FL/Fl_File_Input.H +++ b/FL/Fl_File_Input.H @@ -40,8 +40,15 @@ A navigation bar located above the input field allows the user to navigate upward in the directory tree. - - \image html Fl_File_Input.gif + You may want to handle FL_WHEN_CHANGED events for tracking text changes + and also FL_WHEN_RELEASE for button release when changing to parent dir. + FL_WHEN_RELEASE callback won't be called if the directory clicked + is the same that the current one. +

\image html Fl_File_Input.gif

+ \note As all Fl_Input derived objects, Fl_File_Input may call its callback + when loosing focus (see FL_UNFOCUS) to update its state like its cursor shape. + One resulting side effect is that you should call clear_changed() early in your callback + to avoid reentrant calls if you plan to show another window or dialog box in the callback. */ class FL_EXPORT Fl_File_Input : public Fl_Input { diff --git a/src/Fl_File_Input.cxx b/src/Fl_File_Input.cxx index 7e96ecdd7..d5a4a698b 100644 --- a/src/Fl_File_Input.cxx +++ b/src/Fl_File_Input.cxx @@ -278,7 +278,7 @@ Fl_File_Input::handle_button(int event) // I - Event // Then do the callbacks, if necessary... set_changed(); - if (when() & FL_WHEN_CHANGED) do_callback(); + if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE) ) do_callback(); } return 1;