Fl_File_Input::value("") didn't work.

The window close callback also needed to set the filename to "".


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2851 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2002-11-20 15:49:24 +00:00
parent 4bf99bdfc6
commit 5f5d68561f
5 changed files with 25 additions and 16 deletions

View File

@ -3,7 +3,7 @@
#include "../FL/Fl_File_Chooser.H"
inline void Fl_File_Chooser::cb_window_i(Fl_Window*, void*) {
fileName->value(directory_);
fileName->value("");
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
window->hide();

View File

@ -26,17 +26,17 @@ class Fl_File_Chooser {open
} {
Fl_Window window {
label {Choose File}
callback {fileName->value(directory_);
callback {fileName->value("");
fileList->deselect();
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
window->hide();} open
private xywh {153 80 490 380} resizable
private xywh {153 80 490 380} hide resizable
code0 {if (title) window->label(title);}
code1 {\#include <stdio.h>}
code2 {\#include <stdlib.h>}
code3 {\#include <string.h>} modal visible
code3 {\#include <string.h>} modal
} {
Fl_Group {} {open
Fl_Group {} {
private xywh {65 10 415 25}
} {
Fl_Choice showChoice {
@ -58,7 +58,7 @@ window->hide();} open
}
}
Fl_Tile {} {
callback {update_preview();} open
callback {update_preview();}
private xywh {10 45 470 225} resizable
} {
Fl_File_Browser fileList {
@ -74,7 +74,7 @@ window->hide();} open
Fl_Group {} {open
private xywh {0 275 480 95}
} {
Fl_Group {} {open
Fl_Group {} {
private xywh {10 275 470 20}
} {
Fl_Check_Button previewButton {
@ -127,7 +127,7 @@ window->hide();} selected
}
}
Fl_Window favWindow {
label {Manage Favorites} open
label {Manage Favorites}
private xywh {580 44 355 150} hide
code0 {favWindow->label(manage_favorites_label);} modal
} {

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.27 2002/11/19 16:37:34 easysw Exp $"
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.28 2002/11/20 15:49:24 easysw Exp $"
//
// More Fl_File_Chooser routines.
//
@ -119,6 +119,9 @@ Fl_File_Chooser::count()
{
// Check to see if the file name input field is blank...
filename = fileName->value();
// printf("Fl_File_Chooser::count(): filename=\"%s\"\n", filename);
if (filename == NULL || filename[0] == '\0')
return (0);
@ -413,6 +416,7 @@ Fl_File_Chooser::fileListCB()
filename = pathname + strlen(pathname) - 1;
if (*filename == '/') *filename = '\0';
// puts("Setting fileName from fileListCB...");
fileName->value(pathname);
// Update the preview box...
@ -448,6 +452,8 @@ Fl_File_Chooser::fileNameCB()
const char *file; // File from directory
// puts("fileNameCB()");
// Get the filename from the text field...
filename = (char *)fileName->value();
@ -785,6 +791,7 @@ Fl_File_Chooser::rescan()
if (pathname[0] && pathname[strlen(pathname) - 1] != '/') {
strlcat(pathname, "/", sizeof(pathname));
}
// puts("Setting fileName in rescan()");
fileName->value(pathname);
if (type_ & DIRECTORY)
@ -1152,5 +1159,5 @@ unquote_pathname(char *dst, // O - Destination string
//
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.27 2002/11/19 16:37:34 easysw Exp $".
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.28 2002/11/20 15:49:24 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: Fl_File_Input.cxx,v 1.1.2.8 2002/11/19 16:37:34 easysw Exp $"
// "$Id: Fl_File_Input.cxx,v 1.1.2.9 2002/11/20 15:49:24 easysw Exp $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
@ -153,8 +153,7 @@ Fl_File_Input::value(const char *str, // I - New string value
int // O - TRUE on success
Fl_File_Input::value(const char *str) { // I - New string value
damage(FL_DAMAGE_BAR);
if (*str) return Fl_Input::value(str);
else return 0;
return Fl_Input::value(str);
}
@ -271,5 +270,5 @@ Fl_File_Input::handle_button(int event) // I - Event
//
// End of "$Id: Fl_File_Input.cxx,v 1.1.2.8 2002/11/19 16:37:34 easysw Exp $".
// End of "$Id: Fl_File_Input.cxx,v 1.1.2.9 2002/11/20 15:49:24 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
//
// "$Id: file_chooser.cxx,v 1.4.2.3.2.8 2002/07/14 18:19:00 easysw Exp $"
// "$Id: file_chooser.cxx,v 1.4.2.3.2.9 2002/11/20 15:49:24 easysw Exp $"
//
// File chooser test program.
//
@ -323,6 +323,9 @@ show_callback(void)
for (i = 1; i <= count; i ++)
{
if (!fc->value(i))
break;
fl_filename_relative(relative, sizeof(relative), fc->value(i));
files->add(relative,
@ -335,5 +338,5 @@ show_callback(void)
//
// End of "$Id: file_chooser.cxx,v 1.4.2.3.2.8 2002/07/14 18:19:00 easysw Exp $".
// End of "$Id: file_chooser.cxx,v 1.4.2.3.2.9 2002/11/20 15:49:24 easysw Exp $".
//