Hi all,
In the example below. How can I print the size of the label instead of the circle’s size? v := RTView new. el := RTEllipse new size: 5; elementOn:'number'. v add: el. el @ (RTLabelled new fontSize:30). el @ (RTPopup new textElement:[:e| e width asString]). v _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
What do you mean by "the size of the label"? It's width? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |v el lbl| v := RTView new. el := RTEllipse new size: 5; elementOn: 'number'. v add: el. (lbl := RTLabelled new) fontSize: 30. el @ lbl. el @ (RTPopup new text: [:e | lbl lbl width asString]). v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Or you can be exlicit and add RTLabel as a new shape, but then you would have to manually setup the interaction. Peter On Thu, Sep 3, 2015 at 2:57 PM, Leonel Merino <[hidden email]> wrote:
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Hi Peter, Thanks for your prompt answer. Yes, I meant width :) How can I retrieve the label (RTLabelled) from an element object (RTElement)? I don’t have a reference to the label (as in the example) but only to the element.
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Well... if you are doing this for a one-off visualization (i.e. you will throw the code away within next few months), you could do this ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |v el| v := RTView new. el := RTEllipse new size: 5; elementOn:'number'. v add: el. el @ (RTLabelled new fontSize:30). el @ (RTPopup new textElement:[:e| (e attributeAt: #RTLabelledLabel) width asString]). v ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ the problem is that it is fragile because it relies on internal implementation. On the bright side this is unlikely to change anytime soon. More robust solution would be to create the label manually, but that is a bit more work. Is this enough? Do you need more robust solution? Peter On Thu, Sep 3, 2015 at 4:05 PM, Leonel Merino <[hidden email]> wrote:
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
That’s perfect. I don’t need a robust solution. I am playing with a new layout and wanted to properly handle elements that have labels.
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
In reply to this post by Peter Uhnak
Thanks Peter!
I would not have said better :-) Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |