[Cuis] StringMorph and lf

Juan Vuletich juan at jvuletich.org
Thu Jan 29 08:38:08 CST 2015


Hi Dan,

On 1/29/2015 12:22 AM, Dan wrote:
> ...
> The window won't contain all the lines at times, so lock and hideScrollBarsIndefinitely prevent
> the user from seeing everything. Here's what seems to give the best results so far, but there
> are problems with the scroll bars. This method is sent to self by #initialize:
>
> setupBoard
> 	"Specify the layout for the<...>  window"
> 	| status statusMorph clues |
> 	
> 	status := LayoutMorph newRow
> 		addMorph: (statusMorph := TextModelMorph
> 			withModel: (statusString := TextModel withText: 'Status Area')).
> 			
> 	buttonPane := LayoutMorph newRow
> 		padding: #center;
> 		color: Color lightGreen.
> 	
> 	clues := LayoutMorph newRow
> 		addMorph: (cluesMorph := TextModelMorph
> 			withModel: (cluesString := TextModel withText: 'Clues Area')).
> 			
> 	statusMorph askBeforeDiscardingEdits: false;
> 		wrapFlag: true;
> 		hideOrShowScrollBars.
> 			
> 	cluesMorph askBeforeDiscardingEdits: false;
> 		wrapFlag: false; "false because clues are short one-liners"
> 		hHideScrollBar; "<--- ***** note: it is not hidden"
> 		hideOrShowScrollBars.
> 		
> 	self layoutMorph
> 			addMorph: status proportionalHeight: 0.15;		
> 			addAdjusterAndMorph: buttonPane proportionalHeight: 0.05;		
> 			addAdjusterAndMorph: clues proportionalHeight: 0.80.
>
> This way of laying out is a big improvement over Morphic 2. However problems with the
> above are that the vertical scroll slider extends beyond its owner's extent. It resumes normal
> size only after the window is resized. The horizontal scroll bar defies my efforts to remove it.
> Let me know if I should send the rest of the code to you.
>

There were a couple of bugs there. Most TextModelMorphs do wordwrap, so 
wrapFlag: false isn't well tested. The attach includes fixes, and a new 
capability to disable keyboard input.

Modify your code to read:

         statusMorph askBeforeDiscardingEdits: false;
                 wrapFlag: true;
             disableKeyboard.

         cluesMorph askBeforeDiscardingEdits: false;
                 wrapFlag: false; "false because clues are short one-liners"
             disableKeyboard.

There's no need to do any specific setup to scrollbars anymore.

This change set will be in the next bunch of updates.

Cheers,
Juan Vuletich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2170-TextMorphEnhancements-JuanVuletich-2015Jan29-10h15m-jmv.3.cs.zip
Type: application/zip
Size: 1937 bytes
Desc: not available
URL: <http://jvuletich.org/pipermail/cuis_jvuletich.org/attachments/20150129/2d79fd3f/attachment-0004.zip>


More information about the Cuis mailing list