LB Booster
« little problem with file selection dialog »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:44am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 veryhotthread  Author  Topic: little problem with file selection dialog  (Read 2176 times)
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: little problem with file selection dialog
« Reply #7 on: Mar 24th, 2016, 9:26pm »

on Mar 24th, 2016, 7:58pm, pierscintilla wrote:
On LB 4.04 the filedialog not remember the last used position ::)

That's what I suspected - in fact I'm pretty sure I changed the LBB behaviour in order to improve compatibility with LB 4.

The difficulty I face is that whatever I do I will probably upset somebody. The way it works now programs will run as they would in LB4. If I restore the v3.00 behaviour FILEDIALOG will open where Windows decides is best (which depends on a number of factors) and compatibility may suffer. But it would mean that - in some circumstances at least - the 'last selected' directory will be remembered which can be a useful feature.

It's perhaps worth pointing out that if I do revert to the earlier behaviour it would be possible to force FILEDIALOG to open in the 'current directory' (DefaultDir$) by prefixing the template string with ".\":

Code:
    FILEDIALOG "Test", ".\*.bas", returnVar$ 

So can I ask for people's opinion? I will assume that pierscintilla's vote is for the v3.00 behaviour!

Richard.
« Last Edit: Mar 24th, 2016, 9:28pm by Richard Russell » User IP Logged

michael
New Member
Image


member is offline

Avatar




PM


Posts: 28
xx Re: little problem with file selection dialog
« Reply #8 on: Mar 24th, 2016, 9:45pm »

Directory history and remembering where something is is a very important feature. Would be nice to have a directory history feature built in both your IDE platforms also since that would definitely put them on another level altogether.
Once a directory is changed LBB and BBC look for the required files/libraries in the current directory you have selected.
Having a directory history would allow a search history to be executed and things would be soo much easier. And I suspect such a feature could be made by making the IDE record the saves and loads directory paths in a file directory/path history folder( which would also need to be remembered, but that could be updated and carried in any directory you move to..as well as in the core directory..)

SO the file directory path file would be updated in the old location, and as well as in any directory that you save or load from... (safeguards would need to be made for read only sources)
User IP Logged

I make program generators and some utilities. Its my hobby
Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: little problem with file selection dialog
« Reply #9 on: Mar 24th, 2016, 10:16pm »

on Mar 24th, 2016, 9:45pm, michael wrote:
Would be nice to have a directory history feature built in both your IDE platforms also since that would definitely put them on another level altogether.

Windows 10 already provides a similar functionality in its 'Quick access' feature. Because LBB (both the IDE and the interpreter) utilises the standard GetOpenFileName dialog this functionality is made available without any extra effort.

Anyway I don't want to divert attention from the current issue which is specifically related to the FILEDIALOG statement in LBB.

Richard.
User IP Logged

RobM
Junior Member
ImageImage


member is online

Avatar




PM


Posts: 91
xx Re: little problem with file selection dialog
« Reply #10 on: Mar 25th, 2016, 12:25am »

on Mar 24th, 2016, 9:26pm, Richard Russell wrote:
So can I ask for people's opinion? I will assume that pierscintilla's vote is for the v3.00 behaviour!

Richard.


I always specify the directory so any change probably wouldn't have an effect on my program. I also save the user's chosen directory in a settings file and use that if it is different than the default.
User IP Logged

joker
Global Moderator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 157
xx Re: little problem with file selection dialog
« Reply #11 on: Mar 25th, 2016, 12:35am »

I don't see this as a problem except in a development situation.

In my app, I'm always keeping track of the file locations.

I say use your current strategy of trying to keep up with the LB screw ups. wink
User IP Logged

pierscintilla
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 30
xx Re: little problem with file selection dialog
« Reply #12 on: Mar 25th, 2016, 7:34pm »

Obviously I vote for version 3.0.0 and this is because:

1) being windows that decide which is the starting folder (usually the last used folder), the user will have behavior very "familiar" because it will be the behavior of "his Windows"

2) it is certainly possible to adopt the RobM solution (which however may require a first "adjustment" in case the starting folder was not the desired one) but this solution is far more complicated than a simple ".\" that is also an extremely intuitive solution!!

3) are not at all agree with the statement of pnlawrence according to which the problem would arise only in development and that proposes the same mechanism RobM

4) even in the case where the desired starting folder must be always (or almost always be) the DefaultDir$ and for some reason, occasionally, the user select a different folder, even in the case of version 3.0.0 it would be enough return only once at DefaultDir (also without placing this in the code) that this folder remain selected for future selections

5) is not the first time that the LBB behavior differs in part from that of LB to get better results and LBB (!!) has a nice help menu to resolve problems.

Also on Allincon comments I say that the "full path" is almost never available before the selection by the user (if that is not the case, I think that in practice would serve little the filedialog) and the "full path" is also the ".\"...

But, of course, I accept the decision of the people (naturally hoping that increase those who think like me about it) grin
« Last Edit: Mar 25th, 2016, 7:58pm by pierscintilla » User IP Logged

Alincon
Full Member
ImageImageImage


member is offline

Avatar




PM


Posts: 147
xx Re: little problem with file selection dialog
« Reply #13 on: Mar 25th, 2016, 7:35pm »

I would prefer not going backwards on the file dialog question when it seems so simple to just use the full path, as you mentioned above

r.m.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: little problem with file selection dialog
« Reply #14 on: Mar 26th, 2016, 11:19am »

on Mar 25th, 2016, 7:34pm, pierscintilla wrote:
the user will have behavior very "familiar" because it will be the behavior of "his Windows"

I'm not sure that's true. Since the behaviour depends on what the application specifies in the lpstrInitialDir and lpstrFile members there is no 'standard' or 'universal' behaviour for the user to have become familiar with. What you are asking for is what happens when lpstrInitialDir is NULL and lpstrFile contains no path, but that's just as much a 'special case' as what LBB 3.04 does now!

Quote:
this solution is far more complicated than a simple ".\" that is also an extremely intuitive solution!!

I agree that RobM's solution is a lot of work, especially if the program doesn't otherwise need to store any custom information from one run to the next.

Quote:
it would be enough return only once at DefaultDir (also without placing this in the code) that this folder remain selected for future selections

That is, I think, the best argument for your case. It's easy to make the v3.00 behaviour 'mimic' the LB4 behaviour (either in code, by explicitly prefixing a ".\" path, or through the user just once selecting that folder) but it's difficult to make v3.04 mimic the v3.00 behaviour (relies on RobM's technique of storing the user's selection).

Quote:
is not the first time that the LBB behavior differs in part from that of LB to get better results

Indeed. However where possible I try to avoid 'enhanced' LBB behaviour compromising compatibility with LB 4, which in this case it does (although in a relatively minor way).

Quote:
But, of course, I accept the decision of the people

The feedback so far has been insufficient to say that there has been a "decision". I will wait a while and hope that more people express their views.

Richard.
« Last Edit: Mar 26th, 2016, 1:44pm by Richard Russell » User IP Logged

RobM
Junior Member
ImageImage


member is online

Avatar




PM


Posts: 91
xx 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
 
User IP Logged

pierscintilla
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 30
xx 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 ..) cheesy

Good day
Pier
« Last Edit: Mar 27th, 2016, 09:12am by pierscintilla » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
« Last Edit: Mar 27th, 2016, 2:09pm by Richard Russell » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

Jack Kelly
Full Member
ImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 106
xx 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.
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx 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.
User IP Logged

RobM
Junior Member
ImageImage


member is online

Avatar




PM


Posts: 91
xx 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.
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls