I would like to know if an object has a certain property to avoid an error before trying to modify it by code.
For example, is something like this possible?
There is a property called "the properties", that lists all of the, er, properties of any object. Note that the result is in array variable form, so you will want to use the "combine" command to change to an "ordinary" variable.
Once you have that list of properties, you can compare it to other lists, or whatever.
...
get the properties of control "cas_b06f10"
## graphis HAS the dashes prop:
if IT["dashes"] then
## do your thing
## No dashes:
else
## do some other stuff
end if
...
Returns nothing.
(In this case "cas_b06f10" is a "graphic" object.)
I am going to check how to use the 'combine' command.
"Returns nothing" is not true - it returns an array, which is why, as Craig said, you need to use "combine" to make it readable with (for example) a simple "put" statement.
Using combine is not the only way to do anything with the array contents though, as demonstrated by Klaus using direct interrogation of the array key you are interested in.
on mouseUp
answer the dashes of control "cas_b05f17"
-- Replay: 1,9 (correct)
--
--
get the properties of control "cas_b05f17"
## graphis HAS the dashes prop:
if IT["dashes"] then
answer "SI"
else
answer "NO"
end if
-- Replay: "NO"
end mouseup
Querying an empty property will always return empty, whether it's empty because the value of the key hasn't been set, or because the key doesn't exist at all.
So if querying for the existence of a key, checking its value may not tell you what you need to know.
control structure, then if the engine doesn't find the property that you're asking to set, instead of throwing an error, it will just move on, or you can