Spec - Text alignment in LabelModel
Hi, After spending almost two hours digging into Spec I couldn't figure out how to change the alignment of the text in LabelModel. As I'm building a simple calculator, the text has to be right-aligned. The default is left-alginement which makes the calculator display look weird. Any help would be much appreciated. best regards Nacho ----- Nacho Smalltalker apprentice. Buenos Aires, Argentina. -- View this message in context: http://forum.world.st/Spec-Text-alignment-in-LabelModel-tp4719750.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hey, I'm not sure this is the good way to do it, but you can store in your labelModel a Text instead of a String: myComposableModel label text: 'someString' asText. Then you can add attribute to the text: myComposableModel label text addAttribute: TextColor red. myComposableModel label text addAttribute: TextAlignment rightFlush. Try first with TextColor red, because for TextAlignment rightFlush there might be other reason it does not work (i.e. the label model has the width of the text, so modifying the alignment will not modify anything). Best, 2013/11/7 nacho <0800nacho@gmail.com>
Hi, After spending almost two hours digging into Spec I couldn't figure out how to change the alignment of the text in LabelModel. As I'm building a simple calculator, the text has to be right-aligned. The default is left-alginement which makes the calculator display look weird. Any help would be much appreciated. best regards Nacho
----- Nacho Smalltalker apprentice. Buenos Aires, Argentina. -- View this message in context: http://forum.world.st/Spec-Text-alignment-in-LabelModel-tp4719750.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
I checked it seems that TextAlignment is currently broken. Only other text attributes work. sorry. 2013/11/7 Clément Bera <bera.clement@gmail.com>
Hey,
I'm not sure this is the good way to do it, but you can store in your labelModel a Text instead of a String:
myComposableModel label text: 'someString' asText.
Then you can add attribute to the text:
myComposableModel label text addAttribute: TextColor red. myComposableModel label text addAttribute: TextAlignment rightFlush.
Try first with TextColor red, because for TextAlignment rightFlush there might be other reason it does not work (i.e. the label model has the width of the text, so modifying the alignment will not modify anything).
Best,
2013/11/7 nacho <0800nacho@gmail.com>
Hi, After spending almost two hours digging into Spec I couldn't figure out how to change the alignment of the text in LabelModel. As I'm building a simple calculator, the text has to be right-aligned. The default is left-alginement which makes the calculator display look weird. Any help would be much appreciated. best regards Nacho
----- Nacho Smalltalker apprentice. Buenos Aires, Argentina. -- View this message in context: http://forum.world.st/Spec-Text-alignment-in-LabelModel-tp4719750.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Yes, it is. Thanks anyway. I'm still trying to figure out this... ;) nacho *Lic. Ignacio Sniechowski, MBA* On Thu, Nov 7, 2013 at 7:36 PM, Clément Bera <bera.clement@gmail.com> wrote:
I checked it seems that TextAlignment is currently broken. Only other text attributes work. sorry.
2013/11/7 Clément Bera <bera.clement@gmail.com>
Hey,
I'm not sure this is the good way to do it, but you can store in your labelModel a Text instead of a String:
myComposableModel label text: 'someString' asText.
Then you can add attribute to the text:
myComposableModel label text addAttribute: TextColor red. myComposableModel label text addAttribute: TextAlignment rightFlush.
Try first with TextColor red, because for TextAlignment rightFlush there might be other reason it does not work (i.e. the label model has the width of the text, so modifying the alignment will not modify anything).
Best,
2013/11/7 nacho <0800nacho@gmail.com>
Hi, After spending almost two hours digging into Spec I couldn't figure out how to change the alignment of the text in LabelModel. As I'm building a simple calculator, the text has to be right-aligned. The default is left-alginement which makes the calculator display look weird. Any help would be much appreciated. best regards Nacho
----- Nacho Smalltalker apprentice. Buenos Aires, Argentina. -- View this message in context: http://forum.world.st/Spec-Text-alignment-in-LabelModel-tp4719750.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (3)
-
Clément Bera -
Ignacio MatÃas Sniechowski -
nacho