FLTK logo

Re: [RFE] STR #3520: Fixing a FileChooser feature

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.bugs  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [RFE] STR #3520: Fixing a FileChooser feature Albrecht Schlosser May 19, 2019  
 
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Link: https://www.fltk.org/str.php?L3520
Version: 1.4-feature


Attached file "comments.txt"...


Link: https://www.fltk.org/str.php?L3520
Version: 1.4-feature
This comment is taken from the fltk-2.0.x patch, with identifiers
"translated" accordingly:

Using the Dillo web-browser i could experience some rather nasty
nuisance: whenever changing directory in the dialog for choosing
where to save a file, the (suggested or just before selected)
filename is erased and only the directory is displayed for
further selecting.
Closer examination showed that there is no way to change this
behaviour outside FLTK, that in fact fltk::FileChooser was the
culprit.

So, here comes a patch to fix this issue (i hope to use FLTK's
next release "out of the box" ;-):

1) Fl_File_Chooser::directory(..) no longer simply overwrites
   fileName with directory_. Now it retains the basename in there,
   if it is not a directory and is existing or to be created.
   A boolean parameter allows to control whether fileName should be
   overwritten by directory_ at all (e.g. given, when called from
   Fl_File_Chooser::value(..)).

2) Changing directory in Fl_File_Input::handle_button(..) now also
   retains the basename if appropriate, since it looks - let's
   say - not easy to handle this correctly at an upper level.
   (It maybe possible though, by examining the FileInput flags
   - fileNameCB(Fl_File_Input*,void*) instead of fileNameCB() - to
   find out how the change was done and by always maintaining
   an additional fileName-backup in Fl_File_Chooser. But didn't do
   any deeper investigation into that yet.)

besides:

3) Consistency of directory_ and fileName is now forced upon
   return from each of Fl_File_Chooser::directory(..) and
   Fl_File_Chooser::value(..).  Fl_File_Chooser::rescan() is no
   longer involved in updating/overwriting fileName.
   (IMHO, rescan() is really not the place to do that. Let alone
   making this adjustment dependent on window state!)          


Unlike in the FLTK 2.0 patch, no private directory(const char*, bool)
is introduced. Instead the public directory() is augmented with the
boolean parameter, with default value "true". (Making the switch
public should hardly do any harm).

---

class Fl_File_Input should have some 'ftype_' field (CREATE, DIRECTORY,
...) to reflect its caller's intentions. For now - since the input is
checked for "(type_ & CREATE) || fl_filename_isfile()" at the upper
level (Fl_File_Chooser) anyway - we get away without defining it
and its corresponding methods (leaving a Fl_File_Input object even
binary compatible :-)
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.