Notifications
Clear all
[Closed] Simple Button Image Problem
Mar 08, 2013 6:37 am
This may be a stupid question, but I’ve searched and still can’t see why what I’m doing won’t work. Here I did two tests just to try and get anything to show up on the button:
Works (displays image):
on button01 pressed do
(
button01.images = #("enss_tools_16i.bmp", "enss_tools_16a.bmp", 13, 1, 1, 1, 1, false, true)
)
Doesn’t work (displays nothing):
on button01 pressed do
(
b = bitmap 16 16 color:blue
button01.images = #(b, undefined, 1, 1, 1, 1, 1)
)
From what I’ve read on the forum and in the help it seems like the second test should turn the button blue when pressed, but it doesn’t. It seems so simple, where am I going wrong? Thanks!
5 Replies
Mar 08, 2013 6:37 am
rollout ui_imgtag "imgtag"
(
local bm = bitmap 50 50 color:blue
local rm = bitmap 50 50 color:red
checkbutton imgBtn "Click!" images:#(bm,bm,1,1,1,1,1) align:#center height:50 width:50
on imgBtn changed state do
(
imgBtn.images = if state then #(rm,rm,1,1,1,1,1) else #(bm,bm,1,1,1,1,1)
)
)
createdialog ui_imgtag width:100
Mar 08, 2013 6:37 am
Thanks John! That did the trick. It looks like leaving the mask as ‘undefined’ was the problem. Guess I misunderstood the help file.
1 Reply
the mxs help is not for beginners. you have to learn to read between the lines first but… be able to do it, you have to know the subject.