Open tinchodias opened 1 year ago
Yes, a ToButton is more for vFitContent. Have a look at this example:
example_toBasicButton2
| but lab |
lab := ToLabel new text:
(('Button' asRopedText)
fontSize: 40;
yourself).
but := ToGeneralButton new dresser: ToGeneralButtonDresser new.
but matchParent.
but addChild: lab.
but layout alignCenter.
but whenClickedDo: [ self inform: 'clicked' ].
but openInOBlSpace
but it should be possible with a ToButton. I will have a look and push a fixe if it is an issue
with a ToGeneralButton:
example_toBasicButton4
| but lab ico pane |
pane := ToPane new.
pane fitContent.
pane layout alignCenter.
lab := ToLabel new text: 'Button'.
ico := ToImage inner: (self iconNamed: #remove).
pane addChildren: { lab. ico }.
but := ToGeneralButton new dresser: ToGeneralButtonDresser new.
but matchParent.
but addChild: pane.
but layout alignCenter.
but whenClickedDo: [ self inform: 'clicked' ].
but openInOBlSpace
Many thanks!
How do you recommend to build a button like this in morphic?
I started with an example in
ToSandbox
, with aToButton
, but I think I should useToGeneralButton
. Am I right?