lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Meaning of wxFLP_FILE_MUST_EXIST


From: Vadim Zeitlin
Subject: Re: [lmi] Meaning of wxFLP_FILE_MUST_EXIST
Date: Thu, 9 Jun 2016 17:06:06 +0200

On Thu, 9 Jun 2016 14:09:11 +0000 Greg Chicares <address@hidden> wrote:

GC> Using lmi HEAD, I can enter a nonexistent file in this control:
GC> 
GC>   <object class="wxFilePickerCtrl" name="DefaultInputFilename">
GC>     
<style>wxFLP_OPEN|wxFLP_FILE_MUST_EXIST|wxFLP_USE_TEXTCTRL|wxFLP_SMALL</style>
GC>                       ^^^^^^^^^^^^^^^^^^^^^
GC> 
GC> and it's accepted--and I like that behavior, because I can
GC> manually type the name of a nonexistent file in order to have
GC> no custom default.

 Yes, I like it for the same reason, but also because I don't really see
any alternative: we can't prevent the user from typing any arbitrary text
into the control if we have wxFLP_USE_TEXTCTRL style.

GC> I do however think the wx documentation
GC>   http://docs.wxwidgets.org/3.0/classwx_file_picker_ctrl.html
GC> could be improved.
GC> 
GC> It says
GC> | wxFLP_FILE_MUST_EXIST:
GC> | Can be combined with wxFLP_OPEN only: the selected file must be an 
existing file.
GC> which isn't necessarily wrong if "selected" means picked in
GC> the popup.

 Yes, this is my reading of it.

GC> It wouldn't hurt to mention that a nonexisting file
GC> name can always be manually typed into the managed text control
GC> (when wxFLP_USE_TEXTCTRL is specified), and will be accepted.

 Agreed.

GC> Then it also says
GC> | void wxFilePickerCtrl::SetPath(const wxString & filename)         
GC> | Sets the absolute path of the currently selected file.
GC> | This must be a valid file if the wxFLP_FILE_MUST_EXIST style was given.
GC> I think the last sentence is incorrect and should be deleted.

 Not quite, it is indeed incorrect for the controls with wxFLP_USE_TEXTCTRL
style, but not for the native wxFilePickerCtrl in wxGTK which doesn't use
this style and doesn't accept invalid paths without it. Unfortunately the
generic version of the control does seem to accept them, with or without
wxFLP_USE_TEXTCTRL style, so it's a bit of a mess right now and ideally
we'd standardize on the same behaviour on all platforms, but for now I'll
just describe how does it actually behave.

GC> I would strongly prefer that the code not change. I'm only
GC> saying that the documentation could describe it better.

 Definitely, done now in

https://github.com/wxWidgets/wxWidgets/commit/3eae97d2d71a270031b8b3f3f02051e243613b45

 Please let me know if you have any comments, thanks in advance,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]