Author |
Topic: little problem with file selection dialog (Read 2169 times) |
|
RobM
Junior Member
member is offline


Posts: 91
|
 |
Re: little problem with file selection dialog
« Reply #15 on: Mar 26th, 2016, 3:13pm » |
|
I wouldn't say the way I do it is a lot of work but it is necessary for my program. It only opens one file type but I create and save 4 different file types which the user may want to store in different locations.
This is what I use for setting up the file dialog and how the info is saved. Not too many lines ;)
Code:
gosub [OpenStandards]
gettrim #stan, SettingsNum
close #stan
if lastcsvfolder$<>"" then
StartPath$ = lastcsvfolder$;"*.csv"
else
StartPath$ = GetSpecialfolder$(5);"*.csv"
end if
filedialog "Select CSV file name and save location", StartPath$, CSVfile$
if CSVfile$<>"" then
l=len(CSVfile$)
temp$=CSVfile$
while right$(temp$,1)<>"\"
l=l-1
temp$=left$(temp$,l)
wend
gosub [OpenStandards]
lastcsvfolder$=temp$
put #stan, SettingsNum
close #stan
end if
|
|
Logged
|
|
|
|
pierscintilla
New Member
member is offline


Gender: 
Posts: 30
|
 |
Re: little problem with file selection dialog
« Reply #16 on: Mar 27th, 2016, 09:06am » |
|
Happy Easter to everybody and I wish you to enjoy a little rest at least for today!
As for the "referendum" on filedialog, I believe that the answers may be more "weighted" if Richard could provide a short list of the behavioral differences between the two versions in discussion possibly with a short comment on the pros and the cons for each difference and possible ways of passing each against but I realize that it is much to ask....
For RooM: probably is not a "lot of work" in absolut but always much worse than a simple ". \" (especially if you do not need that). I prefer to spend my time on more important aspects of my sw and I remain faithful to the famous "KISS" principle that we all know (Keep It Simple etc ..)
Good day Pier
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: little problem with file selection dialog
« Reply #17 on: Mar 27th, 2016, 1:59pm » |
|
on Mar 27th, 2016, 09:06am, pierscintilla wrote:| if Richard could provide a short list of the behavioral differences between the two versions in discussion possibly with a short comment on the pros and the cons for each difference and possible ways of passing each against but I realize that it is much to ask.... |
|
I don't think there's much more to say than what has been said already:
Option 1 (status quo):
The second parameter of FILEDIALOG ('template') is handled in the standard way that Windows normally treats filenames:If an absolute path is specified, the FILEDIALOG opens with that directory initially selected.
If a relative path is specified, FILEDIALOG opens in the directory which has the specified relationship with the 'current directory' (DefaultDir$).
If no path is included, FILEDIALOG opens with the 'current directory' initially selected. As far as I am aware this is identical to how LB 4.04 and 4.5.0 behave.
Option 2 (change):
If the second parameter of FILEDIALOG ('template') contains an absolute or relative path the behaviour is the same as Option 1 above, but if it contains no path the behaviour is different:If the program has been run before, and the user made a selection in the FILEDIALOG, this most recently selected path is used as the initial directory.
Failing that, if the 'current directory' contains any files of the specified filter types, the initial directory is the current directory.
Failing that, the initial directory is the personal files directory of the current user (or the Desktop if he doesn't have one). In most cases, therefore, the application will 'remember' the directory which was most recently selected.
If I don't make a change, an equivalent behaviour to Option 2 above can be emulated by saving the selected path to the registry or file, and using that as the initial directory next time (as RobM described).
If I do make a change, an equivalent behaviour to Option 1 above can be emulated by prefixing the template string with ".\".
Richard.
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: little problem with file selection dialog
« Reply #18 on: Mar 30th, 2016, 11:42am » |
|
on Mar 27th, 2016, 1:59pm, Richard Russell wrote:Option 1 (status quo): Option 2 (change): |
|
I described the options in as much detail as I could, but there's been no response since. Let me turn the question around and put pierscintilla's case more directly: would anybody actually have any objection to me making the change he has asked for? Would anybody's program(s) be adversely affected by that change?
Richard.
|
|
Logged
|
|
|
|
Jack Kelly
Full Member
member is offline


Gender: 
Posts: 106
|
 |
Re: little problem with file selection dialog
« Reply #19 on: Mar 30th, 2016, 4:16pm » |
|
FileDialog is ok for me either way. Why don't you do what's best for Rob in Cabinet Planner.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: little problem with file selection dialog
« Reply #20 on: Mar 30th, 2016, 4:25pm » |
|
on Mar 30th, 2016, 4:16pm, Jack Kelly wrote:| FileDialog is ok for me either way. Why don't you do what's best for Rob in Cabinet Planner. |
|
Rob said it would make no difference to CP, because he always explicitly sets the initial directory.
Richard.
|
|
Logged
|
|
|
|
RobM
Junior Member
member is offline


Posts: 91
|
 |
Re: little problem with file selection dialog
« Reply #21 on: Mar 30th, 2016, 4:39pm » |
|
I think option 2, having the filedialog remember the last directory if none is specified, would be best. That is normal for most programs.
|
|
Logged
|
|
|
|
pierscintilla
New Member
member is offline


Gender: 
Posts: 30
|
 |
Re: little problem with file selection dialog
« Reply #22 on: Mar 30th, 2016, 5:00pm » |
|
Thank once again Richard for the tireless commitment that he shows!!
|
|
|
|
joker
Global Moderator
member is offline


Gender: 
Posts: 157
|
 |
Re: little problem with file selection dialog
« Reply #23 on: Mar 31st, 2016, 09:26am » |
|
Option 2 is actually how I like to operate anyway, by default. I would have no objections.
And ... change is good! Keeps 'em guessing!
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: little problem with file selection dialog
« Reply #24 on: Apr 19th, 2016, 11:32am » |
|
Just to say that I've not forgotten about this, but it's not high on my list of priorities. It was, after all, more than six months before the change in the behavior of the FILEDIALOG in v3.01, to improve the compatibility with LB 4, was even commented upon!
As the preference, on balance, seems to be to reverse that change I will tentatively aim to do so around June, which is the next date on which I would normally be considering an update (always assuming that by then I've not once again 'abandoned' LBB, which on past experience is entirely possible!).
Richard.
|
|
|
|
pierscintilla
New Member
member is offline


Gender: 
Posts: 30
|
 |
Re: little problem with file selection dialog
« Reply #25 on: Apr 19th, 2016, 4:58pm » |
|
Thanks for your answer and we hope that does not abandon LBB !!
Pier
|
|
Logged
|
|
|
|
|