[Cuis] Newbie question

Hari Balaraman hbalaraman at gmail.com
Mon Mar 30 09:22:50 CDT 2015


Hi Juan,

Thanks very much for your comments. I will review your suggestions asap. As a temporary solution, I copied PluggableScrollPane, renamed it, and revised the initialize method (bypassing the instantiation of innerMorph) thus:

initialize: aMorphClass
	
	"initialize the state of the receiver"
	| n |
	super initialize.
	hideScrollBars _ false.

	"initialize the receiver's scrollBars"
	scrollBar _ self scrollBarClass new model: self setValueSelector: #vScrollBarValue:.
	hScrollBar _ self scrollBarClass new model: self setValueSelector: #hScrollBarValue:.
	drawKeyboardFocusIndicator _ true.
	
	n:=SystemWindow new.
	n addMorph:self.
	
	"scroller _ self innerMorphClass new."
	scroller:=aMorphClass new.

	scroller morphExtent:8000 at 8000.
	self addMorph: scroller.
	self scrollerOffset: 0@ 0.
	self addMorph: scrollBar.
	self addMorph: hScrollBar.
	n openInWorld.

and a) deleted initialize, and b)set up dummy adjustExtent messages within my embedded objects (and planned to tangle with adjustExtent later…).

Some comments:

1.I’ve spent a some time reviewing the LayoutMorph class examples and have had a certain amount of difficulty in using them. I am using squeak documentation whenever I am stuck in my efforts, so if layouts are a marked departure from Squeak,I would like to request more documentation (in class comments, faq wherever) on when/how layouts are instantiated by objects and are used.

2. One of the things I like about Cuis is the relative positioning of morphs within containers. This has allowed me to build my (very simple) UI without considering layouts.

3. Not having an intermediary layout layer has allowed me to easily make calls to and from embedded objects within the containers in my system (I considered a decoupled model and spent some time on a version of the announcements framework which I imported from Squeak, but, scattered documentation and various versions later, I have abandoned that approach.) SystemWindow creates a LayoutMorph by default. Looking up the hierarchy, I haven’t as yet, located where the LayoutMorph instantiation behaviour occurs. I would dearly love to get around LayoutMorphs by toggling a switch or preference, and play puppeteer in a more direct fashion (I know, I know, you are shaking your head in despair.)

Best regards,

Hari


> On Mar 30, 2015, at 8:51 AM, Juan Vuletich <juan at jvuletich.org> wrote:
> 
> Hi Folks,
> 
> On 3/28/2015 11:26 PM, Ken.Dickey wrote:
>> On Sat, 28 Mar 2015 18:47:04 -0400
>> "Phil (list)"<pbpublist at gmail.com>  wrote:
>> 
>>>> I’ve been looking up Squeak/Pharo/Cuis documentation on using layouts
>>>> (which may be the issue) but have made little headway.
>> Cuis layouts are different from Squeak or Pharo.  Given the changes going on, many things require some code reading and playing around.
>> 
>> To understand Layouts and LayoutSpecs, I did simple editors for them.  They are located in the Morphic-Misc1 package at:
>>   https://github.com/KenDickey/Cuis-Smalltalk-Morphic-Misc1
>> 
>> From the readme:
>> "
>> After loading this package, one can select a morph, open its menu from the halo, and edit its LayoutSpec.
>> If the morph is a LayoutMorph, one can also open an editor for the LayoutMorph from the halo menu.
>> "
>> 
>> Inspecting the window submorphs should help as well.
>> 
>> Cheers,
>> -KenD
> 
> Hari, you were really close. Unfortunately, a bug in Cuis made it harder than needed. Besides trying Ken suggestion, also do the following:
> 
> 1) Change #addToScroller: to read
> addToScroller: aMorph
> 
>    scroller
>        addMorph: aMorph position: 0 at 0;
>        morphExtent: aMorph morphExtent
> 
> (just found a bug. This fix will be on GitHub soon)
> 
> 2) Take a look at #inATwoWayScrollPane. Try the comment:
> 
> (EllipseMorph new morphExtent: 500 at 270) inATwoWayScrollPane openInHand
> 
> 3) Change your code to read:
> mArea := ( DragAndDropAreaMorph new color: Color white) inspect openInWorld.
> scrollpane := (PluggableScrollPane new color: Color red) openInWorld .
> scrollpane inspect.
> gWindow := SystemWindow new.
> gWindow addMorph: scrollpane.
> 
> mArea morphExtent: 800 at 800.
> scrollpane addToScroller: mArea.
> 
> qEllipse := EllipseMorph new.
> mArea addMorph: qEllipse.
> qEllipse morphPosition: 200 at 500.
> 
> gWindow openInWorld
> 
> The change was to set the mArea extent prior to adding to the scroller.... Maybe we'd make InnerPluggableMorph>>#adjustExtent work! If you keep playing with this, and find out whow you think it should behave, please send us your code, for integration.
> 
> Cheers,
> Juan Vuletich
> 
> 
> _______________________________________________
> Cuis mailing list
> Cuis at jvuletich.org
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150330/f81ede88/attachment-0004.html>


More information about the Cuis mailing list