LAF Function? || How do I LAF for Button "disabled" state??
-
pretty much the title...
Thank you if you can help!
-
C Chazrox marked this topic as a question
-
@Chazrox Try this
const var Button1 = Content.getComponent("Button1"); const var STATE_LAF = Content.createLocalLookAndFeel(); STATE_LAF.registerFunction("drawToggleButton", function(g, obj) { g.setColour(0x00FFFFFF); g.fillRect(obj.area); g.setFont("Ariel", 16); if (!obj.enabled) { g.setColour(Colours.red); g.drawAlignedText("DISABLED", obj.area, "centred"); } else if (obj.over) { g.setColour(Colours.yellow); g.drawAlignedText("HOVERED", obj.area, "centred"); } else if (obj.value) { g.setColour(Colours.green); g.drawAlignedText("ONNNNNN", obj.area, "centred"); } else { g.setColour(Colours.grey); g.drawAlignedText("OFFFFFF", obj.area, "centred"); } }); Content.getComponent("Button1").setLocalLookAndFeel(STATE_LAF);
-
@rglides said in LAF Function? || How do I LAF for Button "disabled" state??:
if (!obj.enabled) { g.setColour(Colours.red); g.drawAlignedText("DISABLED", obj.area, "centred"); }
Boom that was it!
Thank You!I was doing (obj.disabled)
lmao
-
@Chazrox I tried that too before the ! attempt :D sometimes it's trial and error
-
-
@Chazrox Console.print(trace(obj))
-
@d-healey doh..forgot all about that one tbh.
-
C Chazrox has marked this topic as solved