File object, clicking cancel issue
This nags me since i know MMF, which is around 10 years now. The file object has no condition to check if the cancel button was clicked.
I know of the tricks to comare the result from the file object with strings to work around this issue. Unfortunately there are situations where this fails. Like in my current case. I work from a default path. Means the result from the file object is always a path. The files also exists. They are readable, writable, everything. That`s this method out. And now i am stuck because there is no way to check if cancel was pressed.
Could we please have a "Cancel" condition for the file object?
Re: File object, clicking cancel issue
Tiles,
I agree. Being able to easilly detect the cancel button being selected would clean up a messy situation. And one that can lead to some messy results if things go wrong.
Steve
Re: File object, clicking cancel issue
Yes, that feature is missing, it's in the wish list.
Workaround: put your code in a group, open the selector in an Always event and then test if the selected pathname is empty or not and deactivate the group once it's done.
Re: File object, clicking cancel issue
Thanks Yves. That`s excellent news :)
As told, in my case the comparison if the pathname is empty fails because the result pathname is always a full path. I open the file selector at this full path :)
Re: File object, clicking cancel issue
I have not been able to get that workaround to work either. What is the condition that let's one know that your are "done?"
Steve
Re: File object, clicking cancel issue
You retreive the result of the file object if it is empty. When the result string is not empty the user has clicked OK. When it is empty the user has clicked cancel.
Re: File object, clicking cancel issue
But using what condition? The file dialog box can sit open for quite a while. How do you know when a "" should assume that the cancel button has been clicked?
Steve
Re: File object, clicking cancel issue
That`s the point. When you want to open a file, then click cancel, the file object returns the string "". Means you can stop the stuff that comes afterwards. Else it returns the path towards the chosen file.
But when you need to open a path, then click cancel, well, the path is still valid. You have had the file object open at it. And the file object doesn`t return "" in this case. But the path string. So there is no way to stop the with that connected actions that follows ...