[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-users] Crucial SelectButtonSet request



Felix, would you consider adding the following "font" argument, or something similar, to SelectButtonSet? Maybe also in any of your other GUI classes that could take a "font" argument?  (sorry, I haven't checked these)

I like to define the fonts in GUIs, and I just *know* I'm gonna lose this hack somewhere along the way (file attached).

*new { arg layout,
/*buttonSizeX,
buttonSizeY,*/
labelArrayOrQnty=10, // integer generates numerical labels
action, // action.value(selectedIndex,this)
color,
selectedColor,
x=20,y=20,
// jpw 060422
font= Font("Helvetica", 12); // <-----------------------------------------<<

^super.new.init(layout,x,y,labelArrayOrQnty,action,color,selectedColor, font)
/* ^super.new.init(layout,x,y,labelArrayOrQnty,action,color,selectedColor)*/
}

init { arg layout,x,y,arglabelArray,argaction,
argcolorFunc,argselectedColor, font; // <----------------<<

//layout=layout.asFlowView;//PageLayout;
//layout=layout.asPageLayout;
action="">
colorFunc=argcolorFunc ?? { Color.white };
selectedColor=argselectedColor ?? {Color.red(alpha:0.7)};

if(arglabelArray.isNumber,{
labelArray=Array.series(arglabelArray,0,1) 
},{
labelArray=arglabelArray
});

  butts=
labelArray.collect({ arg la,i;
//var r;
//r = layout.layRight(x.max(la.asString.size * 7),y);
SCButton(layout,(x@y))
.states_([[la.asString,Color.black,colorFunc.value(i)],
[la.asString,Color.black,selectedColor.value(i)]])
.action_({this.select(i)})
// jpw 060422
.font_(font) // <-----------------------------------------<<
});
this.refresh;
}

Cheers, Jim

Attachment: SelectButtonSet.sc
Description: Binary data


--
collision.ist[AT]virgin.net