ID:1938721
 
(See the best response by Ter13.)
Code:
//this works
var/list/params = new
params["text"] = src.name
params["image"] = 'Button.dmi'
winset(src, "buttonElement", list2params(params))

//----------------------
//This does not
var/icon/i = icon('Button.dmi')
//var/icon/o = icon('OtherIcon.dmi')
//i.Blend(o,ICON_OVERLAY)

var/list/params = new
params["text"] = src.name
params["image"] = i
winset(src, "buttonElement", list2params(params))


Problem description:
In the above code, I can happily output an icon to a button if i call it directly, but if I define it as var/icon first, I cannot (which is necessary for the blend steps I want to do).

I know that using winset() to change image params has always been super buggy, so I can't tell if the desired method is bugging out or simply not possible. Or perhaps its possible and I'm not doing it the right way?

On a side note, is there a work-around to the bugs relating to 'image' param?
//if I have this any other way, it breaks.
//Note the variation in how the PNG files are referenced.
mob/proc/setGender(gender as text)
if(gender == "female")
winset (src, null, "male.image=['Male.png']; female.image=['Female_s.png']")
src.gender = FEMALE
else
winset (src, null, "male.image='Male_s.png'; female.image='Female.png'")
src.gender = MALE

Best response
If I recall, you need to use \ref. I always mess this question up, though because I really almost never use interface elements at all.

winset (src, null, "male.image=\ref['Male.png']; female.image=\ref['Female_s.png']")
In response to Ter13
Ah nice - that seems to have solved the issue. Stated more accurately: it worked twice, but given its track record I can't be sure of anything. But thanks nonetheless!

What of outputting icons to the button element? Is it safe to assume that I would need to blend, then Write() a new icon? I hope not...

The interface editor is in desperate need of an update. Its been like 8 years, and the only update it received was indirect: multiple map controls.