summaryrefslogtreecommitdiff
path: root/src/Fl_File_Chooser2.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-05-01 12:41:21 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-05-01 12:41:21 +0000
commit94a9fb879f3bb31785ddca44c6bbaba5283da136 (patch)
tree6be38779406339f510975a43d8bb967ac3a4960d /src/Fl_File_Chooser2.cxx
parent3a33fc7d818cb336bad2cc81a1dc821f6b75f5d0 (diff)
Fix backspace "bug" in file chooser - now treat delete and backspace the
same, eliminating any filename completion value. Added relative argument to fl_file_chooser() and fl_dir_chooser(); both default to 0 (return absolute paths) Give focus to the filename field in the chooser when show() is called. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2157 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_File_Chooser2.cxx')
-rw-r--r--src/Fl_File_Chooser2.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx
index 57696eb11..9a08dbb01 100644
--- a/src/Fl_File_Chooser2.cxx
+++ b/src/Fl_File_Chooser2.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.10 2002/05/01 08:51:59 easysw Exp $"
+// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.11 2002/05/01 12:41:21 easysw Exp $"
//
// More Fl_File_Chooser routines.
//
@@ -575,7 +575,8 @@ Fl_File_Chooser::fileNameCB()
fl_alert("Please choose an existing file!");
}
}
- else if (Fl::event_key() != FL_Delete)
+ else if (Fl::event_key() != FL_Delete &&
+ Fl::event_key() != FL_BackSpace)
{
// Check to see if the user has entered a directory...
if ((slash = strrchr(pathname, '/')) == NULL)
@@ -673,17 +674,11 @@ Fl_File_Chooser::fileNameCB()
fileName->replace(filename - pathname, filename - pathname + min_match,
matchname);
- // Highlight it; if the user just pressed the backspace
- // key, position the cursor at the start of the selection.
- // Otherwise, put the cursor at the end of the selection so
+ // Highlight it with the cursor at the end of the selection so
// s/he can press the right arrow to accept the selection
// (Tab and End also do this for both cases.)
- if (Fl::event_key() == FL_BackSpace)
- fileName->position(filename - pathname + min_match - 1,
- filename - pathname + max_match);
- else
- fileName->position(filename - pathname + max_match,
- filename - pathname + min_match);
+ fileName->position(filename - pathname + max_match,
+ filename - pathname + min_match);
}
else if (max_match == 0) {
fileList->deselect(0);
@@ -696,10 +691,15 @@ Fl_File_Chooser::fileNameCB()
okButton->activate();
else
okButton->deactivate();
+ } else {
+ // FL_Delete or FL_BackSpace
+ fileList->deselect(0);
+ fileList->redraw();
+ okButton->deactivate();
}
}
//
-// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.10 2002/05/01 08:51:59 easysw Exp $".
+// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.11 2002/05/01 12:41:21 easysw Exp $".
//