mirror of
https://github.com/fltk/fltk.git
synced 2026-06-05 08:06:35 +08:00
Fix file chooser bug - show() was calling deselect() when it shouldn't
have been. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2153 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -3,8 +3,7 @@
|
|||||||
#include "../FL/Fl_File_Chooser.H"
|
#include "../FL/Fl_File_Chooser.H"
|
||||||
|
|
||||||
inline void Fl_File_Chooser::cb_window_i(Fl_Window*, void*) {
|
inline void Fl_File_Chooser::cb_window_i(Fl_Window*, void*) {
|
||||||
fileList->deselect();
|
fileName->value(directory_);
|
||||||
fileName->value("");
|
|
||||||
window->hide();
|
window->hide();
|
||||||
}
|
}
|
||||||
void Fl_File_Chooser::cb_window(Fl_Window* o, void* v) {
|
void Fl_File_Chooser::cb_window(Fl_Window* o, void* v) {
|
||||||
@@ -92,8 +91,7 @@ void Fl_File_Chooser::cb_okButton(Fl_Return_Button* o, void* v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void Fl_File_Chooser::cb_Cancel_i(Fl_Button*, void*) {
|
inline void Fl_File_Chooser::cb_Cancel_i(Fl_Button*, void*) {
|
||||||
fileList->deselect();
|
fileName->value(directory_);
|
||||||
fileName->value("");
|
|
||||||
window->hide();
|
window->hide();
|
||||||
}
|
}
|
||||||
void Fl_File_Chooser::cb_Cancel(Fl_Button* o, void* v) {
|
void Fl_File_Chooser::cb_Cancel(Fl_Button* o, void* v) {
|
||||||
@@ -213,7 +211,6 @@ const char * Fl_File_Chooser::label() {
|
|||||||
void Fl_File_Chooser::show() {
|
void Fl_File_Chooser::show() {
|
||||||
window->hotspot(fileList);
|
window->hotspot(fileList);
|
||||||
window->show();
|
window->show();
|
||||||
fileList->deselect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Fl_File_Chooser::shown() {
|
int Fl_File_Chooser::shown() {
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ class Fl_File_Chooser {open
|
|||||||
} {
|
} {
|
||||||
Fl_Window window {
|
Fl_Window window {
|
||||||
label {Pick a File}
|
label {Pick a File}
|
||||||
callback {fileList->deselect();
|
callback {fileName->value(directory_);
|
||||||
fileName->value("");
|
|
||||||
window->hide();} open
|
window->hide();} open
|
||||||
private xywh {99 225 375 325} resizable
|
private xywh {99 225 375 325} resizable
|
||||||
code0 {if (title) window->label(title);}
|
code0 {if (title) window->label(title);}
|
||||||
@@ -78,8 +77,7 @@ window->hide();}
|
|||||||
}
|
}
|
||||||
Fl_Button {} {
|
Fl_Button {} {
|
||||||
label Cancel
|
label Cancel
|
||||||
callback {fileList->deselect();
|
callback {fileName->value(directory_);
|
||||||
fileName->value("");
|
|
||||||
window->hide();}
|
window->hide();}
|
||||||
private xywh {285 290 80 25}
|
private xywh {285 290 80 25}
|
||||||
code0 {o->label(fl_cancel);}
|
code0 {o->label(fl_cancel);}
|
||||||
@@ -154,8 +152,8 @@ rescan();} {}
|
|||||||
Function {show()} {open return_type void
|
Function {show()} {open return_type void
|
||||||
} {
|
} {
|
||||||
code {window->hotspot(fileList);
|
code {window->hotspot(fileList);
|
||||||
window->show();
|
window->show();} {selected
|
||||||
fileList->deselect();} {}
|
}
|
||||||
}
|
}
|
||||||
Function {shown()} {return_type int
|
Function {shown()} {return_type int
|
||||||
} {
|
} {
|
||||||
@@ -217,7 +215,7 @@ else
|
|||||||
}
|
}
|
||||||
decl {static const char *filename_label;} {public
|
decl {static const char *filename_label;} {public
|
||||||
}
|
}
|
||||||
decl {static const char *filter_label;} {selected public
|
decl {static const char *filter_label;} {public
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.8 2002/04/30 21:50:16 easysw Exp $"
|
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.9 2002/05/01 08:28:59 easysw Exp $"
|
||||||
//
|
//
|
||||||
// More Fl_File_Chooser routines.
|
// More Fl_File_Chooser routines.
|
||||||
//
|
//
|
||||||
@@ -656,14 +656,13 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileList->deselect(0);
|
|
||||||
fileList->redraw();
|
|
||||||
|
|
||||||
// If we have any matches, add them to the input field...
|
// If we have any matches, add them to the input field...
|
||||||
if (first_line > 0 && min_match == max_match &&
|
if (first_line > 0 && min_match == max_match &&
|
||||||
max_match == (int)strlen(fileList->text(first_line))) {
|
max_match == (int)strlen(fileList->text(first_line))) {
|
||||||
// This is the only possible match...
|
// This is the only possible match...
|
||||||
|
fileList->deselect(0);
|
||||||
fileList->select(first_line);
|
fileList->select(first_line);
|
||||||
|
fileList->redraw();
|
||||||
}
|
}
|
||||||
else if (max_match > min_match && max_match != 100000)
|
else if (max_match > min_match && max_match != 100000)
|
||||||
{
|
{
|
||||||
@@ -683,6 +682,10 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
fileName->position(filename - pathname + max_match,
|
fileName->position(filename - pathname + max_match,
|
||||||
filename - pathname + min_match);
|
filename - pathname + min_match);
|
||||||
}
|
}
|
||||||
|
else if (max_match == 0) {
|
||||||
|
fileList->deselect(0);
|
||||||
|
fileList->redraw();
|
||||||
|
}
|
||||||
|
|
||||||
// See if we need to enable the OK button...
|
// See if we need to enable the OK button...
|
||||||
if ((type_ & CREATE || access(fileName->value(), 0) == 0) &&
|
if ((type_ & CREATE || access(fileName->value(), 0) == 0) &&
|
||||||
@@ -695,5 +698,5 @@ Fl_File_Chooser::fileNameCB()
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.8 2002/04/30 21:50:16 easysw Exp $".
|
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.9 2002/05/01 08:28:59 easysw Exp $".
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user