Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Picture Loaded in Condition Statement?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
[Gandalf]




PostPosted: Sun May 22, 2005 9:22 pm   Post subject: Picture Loaded in Condition Statement?

I didn't know how else to state this problem.

How you check if there is a certain picture loaded in an if statement. For example, what I tried, which obviously didn't work is:

code:

var pic := Pic.FileNew ("pic.bmp")
if pic := Pic.FileNew ("pic.bmp") then
    put "this picture is loaded"
else
    put "there is no picture loaded"
end if


Do I have to make some boolean condition true when the pic is loaded, and then check for that? It seems like too much hastle...
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun May 22, 2005 9:39 pm   Post subject: (No subject)

Check the Error.Last and Error.LastMsg things. They return values after Pic.New is called, so you can use them to determine whether or not the pic has loaded.
[Gandalf]




PostPosted: Sun May 22, 2005 9:51 pm   Post subject: (No subject)

Hmm, can you explain this a bit more? How do you use Error.Last and Error.LastMsg? If I add what I posted previously, the program doesn't even compile...
Bacchus




PostPosted: Sun May 22, 2005 10:51 pm   Post subject: (No subject)

just check to see if the var = 0, if it does then the pic wasnt created Razz
MysticVegeta




PostPosted: Sun May 22, 2005 10:55 pm   Post subject: (No subject)

unsuccessful pic open error is error # 201
zylum




PostPosted: Mon May 23, 2005 12:25 am   Post subject: (No subject)

code:
var pic := Pic.FileNew ("pic.bmp")
if Error.Last not= 0 then
    put "this picture is loaded"
else
    put "there is no picture loaded"
end if
Cervantes




PostPosted: Mon May 23, 2005 8:01 am   Post subject: (No subject)

Heh, you've got it backwards, zylum. Error.Last returns zero if there is no error.
Turing:

var pic := Pic.FileNew ("pic.bmp")
if Error.Last = 0 then
    put "this picture is loaded"
else
    put Error.LastMsg
end if
MysticVegeta




PostPosted: Mon May 23, 2005 9:28 am   Post subject: (No subject)

Gandalf do you mean if the pic is already open? or the importing file error?
Sponsor
Sponsor
Sponsor
sponsor
zylum




PostPosted: Mon May 23, 2005 9:44 pm   Post subject: (No subject)

Cervantes wrote:
Heh, you've got it backwards, zylum. Error.Last returns zero if there is no error.


yup, you're right Wink
[Gandalf]




PostPosted: Tue May 24, 2005 10:55 pm   Post subject: (No subject)

Thanks for all that, I was looking for something else, but this helps too.

I found a simple way of doing what I wanted, I was just doing things the wrong, redundant way... Thanks for all the help.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 10 Posts ]
Jump to:   


Style:  
Search: