pharo-graphics / Toplo

A widget framework on top of Bloc
MIT License
17 stars 8 forks source link

Question : What type of instance to use as an Icon for a Button ? #61

Open Enzo-Demeulenaere opened 1 year ago

Enzo-Demeulenaere commented 1 year ago

Hello,

I'm trying to add a little icon to a button and I tried using icon: (Smalltalk ui icons iconNamed: #glamorousAccept) just like I do for a menu but it seems that Forms aren't the type of instances expected by this icon: method.

Could you tell me how would you add an icon to a button item ?

Thanks

Enzo-Demeulenaere commented 1 year ago

Ok after trying some things it seems that using BlElements works and fulfills what I needed but I'm open to suggestions if there are better ways to do that

plantec commented 1 year ago

have a look at the examples. This is the same for ToMenu and ToButton. They use the same trait for that aspect (TToLabeledIcon)

m := ToMenu new icon: (ToImage inner: (Smalltalk ui icons iconNamed: #glamorousAccept)).
b := ToButton new icon: (ToImage inner: (Smalltalk ui icons iconNamed: #glamorousAccept)).