Roassal2 - RTVerticalCompositeShape and RTNest

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Roassal2 - RTVerticalCompositeShape and RTNest

Leo Perard
Hi,

using Roassal2 I would like to get a box with some nested element on it and the box get a label above itself.

I tried this but it is not working

view := RTView new.

container := (RTVerticalCompositeShape new
shape1: RTLabel new;
shape2: (RTBox new color: (Color blue alpha: 0.5)))
elementOn: 'Container'.
els := RTEllipse new elementsOn: (1 to: 16).
view add: container; addAll: els.

RTNest new layout: RTGridLayout; on: container nest: els.

view @ RTDraggableView.
view open

As you can see the label is not move due to the resize of the box with the nest.

I do not use TRConstraint because I will have several boxes and if I apply a layout on them the label is not calculate in the size so I do not think this is a solution but RTNest on RTVerticalCompositeShape is. 

--
Cheers,
Leo Perard
University of Lille 1

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal2 - RTVerticalCompositeShape and RTNest

abergel
Hi Leo,

I understand your email. As Doru has been saying, we need a way to specify where the nested elements should go when composing shapes. Currently I have unfortunately no solution.

The approach you can do right now, is the one taken by all the GUI framework that I know: encapsulate the label and the container with its nested element. Here is an example that you can get inspiration from:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| classes allClassElements v es enclosing label g1 back |
classes := RTShape withAllSubclasses.
allClassElements := OrderedCollection new.

v := RTView new.

classes do: [ :cls | 
es := RTBox elementsOn: cls methods.
es @ RTPopup.

back := (RTBox new color: Color blue) element.
RTNest new 
layout: RTGridLayout new;
on: back nest: es.

enclosing := (RTBox new color: Color transparent) element.
label := (RTLabel new text: #name) elementOn: cls.
g1 := RTGroup withAll: { label . back }.
RTNest new 
layout: RTVerticalLineLayout new alignCenter;
on: enclosing nest: g1.

enclosing @ RTDraggable.

v add: enclosing.
v add: back.
v addAll: es.
v add: label.

allClassElements add: enclosing.
].
RTFlowLayout on: allClassElements.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On May 14, 2014, at 5:20 AM, Leo Perard <[hidden email]> wrote:

Hi,

using Roassal2 I would like to get a box with some nested element on it and the box get a label above itself.

I tried this but it is not working

view := RTView new.

container := (RTVerticalCompositeShape new
shape1: RTLabel new;
shape2: (RTBox new color: (Color blue alpha: 0.5)))
elementOn: 'Container'.
els := RTEllipse new elementsOn: (1 to: 16).
view add: container; addAll: els.

RTNest new layout: RTGridLayout; on: container nest: els.

view @ RTDraggableView.
view open

As you can see the label is not move due to the resize of the box with the nest.

I do not use TRConstraint because I will have several boxes and if I apply a layout on them the label is not calculate in the size so I do not think this is a solution but RTNest on RTVerticalCompositeShape is. 

-- 
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal2 - RTVerticalCompositeShape and RTNest

Leo Perard
Yes that was my first idea before you integrate the composite shape.
It is working but there is a lot of inconvenience like a transparent shape that the user don't know its existence, 4 elements (or group) whereas with composite shape there is only one element and a group etc...

I keep this solution but I prefer to wait until a better one will be found.


On Thu, May 15, 2014 at 1:02 AM, Alexandre Bergel <[hidden email]> wrote:
Hi Leo,

I understand your email. As Doru has been saying, we need a way to specify where the nested elements should go when composing shapes. Currently I have unfortunately no solution.

The approach you can do right now, is the one taken by all the GUI framework that I know: encapsulate the label and the container with its nested element. Here is an example that you can get inspiration from:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| classes allClassElements v es enclosing label g1 back |
classes := RTShape withAllSubclasses.
allClassElements := OrderedCollection new.

v := RTView new.

classes do: [ :cls | 
es := RTBox elementsOn: cls methods.
es @ RTPopup.

back := (RTBox new color: Color blue) element.
RTNest new 
layout: RTGridLayout new;
on: back nest: es.

enclosing := (RTBox new color: Color transparent) element.
label := (RTLabel new text: #name) elementOn: cls.
g1 := RTGroup withAll: { label . back }.
RTNest new 
layout: RTVerticalLineLayout new alignCenter;
on: enclosing nest: g1.

enclosing @ RTDraggable.

v add: enclosing.
v add: back.
v addAll: es.
v add: label.

allClassElements add: enclosing.
].
RTFlowLayout on: allClassElements.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On May 14, 2014, at 5:20 AM, Leo Perard <[hidden email]> wrote:

Hi,

using Roassal2 I would like to get a box with some nested element on it and the box get a label above itself.

I tried this but it is not working

view := RTView new.

container := (RTVerticalCompositeShape new
shape1: RTLabel new;
shape2: (RTBox new color: (Color blue alpha: 0.5)))
elementOn: 'Container'.
els := RTEllipse new elementsOn: (1 to: 16).
view add: container; addAll: els.

RTNest new layout: RTGridLayout; on: container nest: els.

view @ RTDraggableView.
view open

As you can see the label is not move due to the resize of the box with the nest.

I do not use TRConstraint because I will have several boxes and if I apply a layout on them the label is not calculate in the size so I do not think this is a solution but RTNest on RTVerticalCompositeShape is. 

-- 
Cheers,
Leo Perard
University of Lille 1
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Cheers,
Leo Perard
University of Lille 1

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev