[squeak-dev] Re: ProportionalLayout not so suitable for Drag-and-Drop?

marcel.taeumel Marcel.Taeumel at hpi.de
Fri Jul 10 12:34:26 UTC 2015


Yes, proportional layouts are difficult to update when dropping an object
into the hierarchy. If you take a look at how proportional splitters work,
you can see that they tweak the #offset property of the adjacent layout
frames.

There is only the TableLayout left, which fits better for adding morphs into
the respective container on-the-fly.

You might want to take a look at the layout policy that I use in Vivide:
https://github.com/hpi-swa/vivide/tree/master/repository/Vivide.package/ViConstraintLayout.class
(It also needs #boundsInOwner: from
https://github.com/hpi-swa/vivide/tree/master/repository/Vivide.package/Morph.extension/instance
but should work in Squeak 4.6 without Vivide.)

It provides interactive layout configuration and automatic scaling.

Here is an example:

m := Morph new.
m layoutPolicy: ViConstraintLayout new.
m topLeft: 0 at 0; extent: 100 at 100.

m addMorph: (Morph new
	topLeft: m topLeft;
	extent: 30 at 30;
	color: Color random).

m addMorph: (Morph new
	topLeft: m topLeft + (50 at 50);
	extent: 30 at 30;
	color: Color random).

m openInHand.


Best,
Marcel



--
View this message in context: http://forum.world.st/ProportionalLayout-not-so-suitable-for-Drag-and-Drop-tp4836801p4836912.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list