Hello Vikenti, I think that you are using the SpecAdapter for morphs in ways it has never been tried or used. So the problems you are having reveal bugs in the SpecAdapter. Please file a bug report, and feel free to contribute a fix as well of course ;-) (more about bugreports here: http://pharo.org/contribute ) -- Does this mail seem too brief? Sorry for that, I donât mean to be rude! Please see http://emailcharter.org <http://emailcharter.org/> . Johan Fabry - http://pleiad.cl/~jfabry PLEIAD and RyCh labs - Computer Science Department (DCC) - University of Chile
On 05 Nov 2016, at 21:37, vikenti <vikenti.potapov@gmail.com> wrote:
New problem with Spec.
Layout consists of menu and custom control (subclass of Morph created by asSpecAdapter): initializeWidgets menu := self instantiate: MenuModel. self setupMenu. menu applyTo: self. locationField := LocationFieldMorph new asSpecAdapter.
defaultSpec <spec: #default> ^ SpecLayout composed newColumn: [ :col | col add: #menu height: self toolbarHeight; add: #locationField ] yourself
My custom control doesn't automatically resize to fill the area reserved to it by layout spec. I've tried different existed controls instead of mine but didn't find any solution. Some controls resized (TextModal) some didn't (Morph, BorderedMorph, EllipseMorph).
I did a dirty hack: in onDraw: of my custom control i set bounds: to aCanvas clipRect and it works fine.
drawOn: aCanvas self bounds: aCanvas clipRect . .... other code ....
But i think it is a wrong solution and there is somewhere a simple property to setup ( or something like it ).
Any ideas?