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 <merino@iam.unibe.ch> wrote:
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.

Leonel Merino


On 03 Sep 2015, at 15:43, Peter Uhnák <i.uhnak@gmail.com> wrote:

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 <merino@iam.unibe.ch> wrote:
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


<PastedGraphic-5.png>

Best regards

Leonel Merino




_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev