Page 1 of 1

Check file exist after load stack.

Posted: Sat Apr 09, 2016 9:42 am
by Marken
I wrote a widget with a property to set image file to show.
I don't want to save pixels data of image in stack. Instead, I just save the path information of the image file.
So after load stack, the widget need to check if the file exists.
Now I use " execute script "return there is a file" " to check file path.
But OnLoad(), OnAttach(), OnPaint() all can't use script object to execute script.
So anyone have other suggestions to check file path after load widget ( after open stack).

Re: Check file exist after load stack.

Posted: Mon Apr 11, 2016 2:21 pm
by livecodeali
Hi Marken,
You could do such a thing in the widget's OnOpen handler.

Re: Check file exist after load stack.

Posted: Mon Apr 11, 2016 2:22 pm
by livecodeali
Alternatively you could use LCB's the entries of directory <directory> operator to check if the file exists.

Re: Check file exist after load stack.

Posted: Tue Apr 12, 2016 2:01 am
by Marken
livecodeali wrote:Hi Marken,
You could do such a thing in the widget's OnOpen handler.
good, I never test OnOpen() handler. Thank you.

Re: Check file exist after load stack.

Posted: Tue Apr 12, 2016 2:04 am
by Marken
livecodeali wrote:Alternatively you could use LCB's the entries of directory <directory> operator to check if the file exists.
the entries of directory will crash with some path at Windows platform. Other other hand, if the <directory> does not exist and what will happen?
Thank you for your information.