Proportional layout with Spec2
Hello, I am currently toying with Spec2. One thing that I have not seen yet is some kind of proportional layout that arranges components according to an offset and a fraction. Would it be possible to implement something like that myself, or are there some technical reasons why this can't work? Holger
Don't morphs still have proportional layouts and fractional offsets if you want? And you can use those morphs in spec 2 as well with SpMorphPresenter. But I thought one of the points of Spec was to get rid of all that old layout nonsense.
Le 02/09/2026 à 22:09, voxkmp--- via Pharo-users a écrit :
Don't morphs still have proportional layouts and fractional offsets if you want? And you can use those morphs in spec 2 as well with SpMorphPresenter. But I thought one of the points of Spec was to get rid of all that old layout nonsense.
We would love :) We hope to get rid of morphic soon :) S
Hello, not sure if this is what you are looking for, but what about SpPanedLayout? It allows splitting the presenters horizontally or vertically by a splitter that is either proportional (like 20:80) or you can set a fixed size (like setting the left/top presenter to 200 pt) and is then movable by mouse by dragging a splitter. Currently there is no possibility to set a fixed size of the right/bottom presenter, but I have already proposed a fix for that: https://github.com/pharo-spec/Spec/pull/1945 Jan
Hello, Spec does not supports any constraint based layout, but in most cases you should be able to achieve what you want by combining the existing ones. Esteban On 9/1/26 16:06, h.kleinsorgen--- via Pharo-users wrote:
Hello, I am currently toying with Spec2. One thing that I have not seen yet is some kind of proportional layout that arranges components according to an offset and a fraction. Would it be possible to implement something like that myself, or are there some technical reasons why this can't work?
Holger
Thank you all for the advise! I kind of managed to do what I was looking for with a custom morphic adaptor and then doing something like this :... ImdbFilmListPresenter >> proportionalLayout ^ SpProportionalLayout new add: filmList withConstraints: [ : constraints | constraints bottomFraction: 0.5 ]; add: detail withConstraints: [ : constraints | constraints topFraction: 0.5 ]; yourself ... but now I am staying away from this "old school" path ;)
participants (6)
-
Esteban Lorenzano -
h.kleinsorgen@gmail.com -
Holger Kleinsorgen -
jan.bliznicenko@fit.cvut.cz -
sducasseatwork -
voxkmp@gmail.com