Notifications
Clear all
[Closed] Possible to avoid "Error on opening bitmap" on image buttons
Feb 08, 2010 6:55 pm
Hi, I have searched this forum and the max help – and I can’t seem to figure out how to fallback to the specified label in a button if an image doesn’t exist.
For example:
button foo "label" images:#("dcybtns.bmp", undefined, 1, 1, 1, 1, 1)
If dcybtns.bmp doesn’t exist I would like to avoid the compile error and just use the text label instead.
I could check if the file exist before in a if/else clause, but I was thinking there had to be an easier way? I couldn’t get try/catch to work either…
3 Replies
Feb 08, 2010 6:55 pm
that’s probably easiest way:
rollout test "test"
(
local images = if doesfileexist (getdir #ui + "\\icons\\dcybtns.bmp") then #("dcybtns.bmp", undefined, 1, 1, 1, 1, 1) else unsupplied
button bt "button" images:images
)
createdialog test
Feb 08, 2010 6:55 pm
Thanks Denis, what if I’d want to check against the folder the script is executed from?
1 Reply