still having a problem with path or filename from 2.8 to 2.9

Eric Chatonet eric.chatonet at sosmartsoftware.com
Wed Apr 23 06:40:10 EDT 2008


Bonjour Thiemo,

I had a quick look at your stack:

on mouseUp pMouseBtnNo
     global myPic
     ask "name of image file? (with suffix)" with myPic
     put it into myPic
     put the defaultfolder into tPathDef

     answer "image in defaultfolder or in subfolder pics?" with  
"pics" or "defaultfolder"
     if it is "pics" then
         put tPathDef & "/pics/" & myPic into tPic
     else
         put tPathDef & "/" & myPic into tPic
     end if

     answer "set the filename of img or image" with "img" or "image"
     lock screen
     if it is "image" then
         set the filename of image "img1" to tPic
         set the height of image "img1" to 200
         set the width of image "img1" to 200
     else
         set the filename of img "img1" to tPic
         set the height of img "img1" to 200
         set the width of img "img1" to 200
     end if
     unlock screen
end mouseUp

This works using 2.9 on Mac but you don't ensure the process:
. What happens if the user says OK in the ask dialog but letting it  
empty?
. Is the current defaultFolder the expected one?
. Does the file exists?
etc.

In addition, from an ergonomic point of view, I would say it's not  
perfect ;-)
In short why don't you use something like:

answer file "Choose an image:" with type "JPEG|jpg|JPEG" or type "PNG| 
png|PNGf"
if it  = empty then return "Cancel"
set the filename of img "img1" to it
set the height of img "img1" to 200
set the width of img "img1" to 200

Le 23 avr. 08 à 12:12, Tiemo Hollmann TB a écrit :

> Hello,
>
> First thank you Sarah for your comment.
>
> Actually my problem is setting the filename to image, which worked  
> with 2.8,
> but doesn't works anymore on 2.9 on Mac in an existing program without
> having changed anything. On Mac the image is still empty after  
> setting the
> filename. My first thought was, that setting the path to the file  
> was going
> wrong, but as it appears, that is working ok. The next relevant  
> statement is
> setting the filename to the image, where I have used
>
> set the filename of img "img1" to tPic
>
> could here has something changed in 2.9? I have seen in the docs  
> that it
> actually should be coded with "image" instead of "img". Could this  
> be the
> problem in 2.9?
>
> I have put a small test stack in my revonline space (Tiemo) for any  
> body who
> could do a little test for me on a Mac ( I still don't have a Mac  
> to test)
> Any comments are highly appreciated!
>
> Perhaps the problem even doesn't occur, when you will test it on  
> Mac In the
> IDE. Perhaps only when compiled on windows and run under Mac? I  
> really don't
> know, where my problem is located.
>
> Thank you
>
> Tiemo




More information about the use-livecode mailing list