System-dialog get-file

Posted by ojfoggin on 06-May-2011 02:47

Hi All,

I'm trying to get this to work properly but it seems that when the system-dialog is open and the user changes the direcotry it changes the current-directory of the progress environment.

i.e. it changes the . location.

This wouldn't be a problem as it changes it back once the dialog is closed.

However, we have a timer event that runs every so often and if it happens to run when the dialog is open then an error is produced saying that the file it is trying to run doesn't exist and this then bombs out of the whole program.

The first entry in the propath is . so I was wondering if there is a way of using the system-dialog without it actually affecting .

Or maybe we should be using the absolute path in the propath rather than .?

Any advice welcome.

Thanks

Oliver

All Replies

Posted by Admin on 06-May-2011 03:00

This should help:

RETURN-TO-START-DIR

This option resets the current directory to the starting directory when the common dialog ends. This is the directory specified by the INITIAL-DIR option or the default starting directory.

If you do not specify this option, the directory remains set at the last directory referenced by the user. This directory becomes the default initial directory for subsequent invocations of SYSTEM-DIALOG GET-FILE. This option also has no effect on subsequent invocations that specify the INITIAL-DIR option.

Posted by ojfoggin on 06-May-2011 03:10

Hi,

Thanks for the reply.

We already use this option, the problem is that while the dialog is open and the current working directory is changed the timed event that runs in the background goes wrong.

I think the best option would be to replace the . in the propath at runtime and use the value of the . instead.

i.e. at runtime do something like...

def var iLoop as int no-undo.

def var tempPropath as char no-undo.

assign

     file-info:file-name = "."

     tempPropath = file-info:full-pathname.

do iLoop = 2 to num-entries(propath):

assign
     tempPropath = "," + entry(iLoop, propath).

end.

assign propath = tempPropath.


This would then remove the dependence of the current working directory from the propath and so allow the propath to do it's own thing regardless of what the user does.

Is there an easier way of doing the above?  I haven't found a way of changing an entry in a list without rebuilding the list.

Posted by Admin on 06-May-2011 03:15

I think the best option would be to replace the . in the propath at runtime and use the value of the . instead.

 

Or suspend the timer while the DLG is open.

This thread is closed