Notifications
Clear all

[Closed] Simple Button Image Problem

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
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

Thanks John! That did the trick. It looks like leaving the mask as ‘undefined’ was the problem. Guess I misunderstood the help file.

I always miss understand the help file.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

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.

Hahaha! Glad I’m not the only one.