[Cuis] Newbie question

Hari Balaraman hbalaraman at gmail.com
Tue May 12 17:19:00 CDT 2015


Hi Ken,

Thanks for your reply. It came in just as I finished a slightly improved version of the code I presented earlier. This code moves the embedded morph in relation to the enclosing morph (by moving the centre of the embedded morph in proportion to the centre of the container morph.) I moved the variables and methods I used in the attached test class (including the stepAt method) upstream to RectangleLikeMorph to test and attach some screenshots (of that testing) when I embed an EllipseMorph into a BorderedRectMorph and switch ‘proportionalresize' off and on within the embedded morph while resizing the container morph. Thus, I maintain control over layout on a per embedded morph basis.
A:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot A.png
Type: image/png
Size: 136090 bytes
Desc: not available
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150512/bdac6c31/attachment-0016.png>
-------------- next part --------------


B: proportionalresize on, container enlarged

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot B.png
Type: image/png
Size: 94993 bytes
Desc: not available
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150512/bdac6c31/attachment-0017.png>
-------------- next part --------------


C: proportionalresize switched off, container made small

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot C.png
Type: image/png
Size: 154901 bytes
Desc: not available
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150512/bdac6c31/attachment-0018.png>
-------------- next part --------------



D: proportionalresize on, container enlarged again.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot D.png
Type: image/png
Size: 93174 bytes
Desc: not available
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150512/bdac6c31/attachment-0019.png>
-------------- next part --------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ProportionallyResizingRect.st
Type: application/octet-stream
Size: 6202 bytes
Desc: not available
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150512/bdac6c31/attachment-0004.obj>
-------------- next part --------------


I don’t yet have a sense of what load the additional variables and methods put on the system when added at the top of the hierarchy (other than my laptop fan not going insane), but since the tax is on the individual embedded morph for maintaining layout, I hope it is small.

Best regards,

Hari


> On May 12, 2015, at 5:52 PM, Ken.Dickey <Ken.Dickey at whidbey.com> wrote:
> 
> On Tue, 12 May 2015 00:24:06 -0400
> Hari Balaraman <hbalaraman at gmail.com> wrote:
> 
>> Hi Juan et al,
>> 
>> I’ve been pondering on how to position and size morphs (based on Juan's comment below about automatic layout in an earlier exchange) without having an intermediate layer of layoutMorphs. 
>> 
>> Attached is a fileout of a test class with a class method “example 1” showing a rectangle that varies its size based on its owner (I’m also writing the method to reset the location of a morph if it wishes to be remain in the same location relative to the midpoints of two sides of the enclosing morph.)
>> 
>> This way a morph can be positioned and at any time sent a message to relocate or resize itself based on its then owner. That way there are only two actors, the morph and its owner, and a morph knows (based on two messages, whether it should maintain its relative place and size within its owner. Although I have got a bit of the hang of layoutMorphs, I’m exploring whether positioning and repositioning a lot of elements in my UI may be easier with this approach.
>> 
>> I was wondering what you think of this approach.
> 
> Hari,
> 
> I think we all need to get more experience building things to see what works and is as simple as we can make it.
> 
> Please continue to build things and share them!
> 
> Here is the example using aLayoutMorpk and a LayoutSpec.
> 
> example2
> "
>    self example2.
> "	| f g |
> 	g := LayoutMorph initializedInstance openInWorld.
> 	g padding: 0.5. "center"
> 	f := RectangleLikeMorph new.
> 	g morphExtent:400 at 400; color: Color orange.
> 	g addMorph: f layoutSpec: (LayoutSpec proportionalWidth: 0.25 proportionalHeight: 0.25).
> 	f morphPosition:150 at 150; color: Color blue.
> 	g morphPosition:70 at 70.
> 
> 
> Cheers,
> -KenD



More information about the Cuis mailing list