[Squeak] Need for GUI-Building-Tool

Ned Konz ned at bike-nomad.com
Tue Jul 16 02:59:17 UTC 2002


On Monday 15 July 2002 06:04 pm, Richard A. O'Keefe wrote:

> What Squeak DOESN'T have is documentation.  Ideally, not only would
> every class have a class comment, but the class comment would
> contain a link to a tutorial.

Agreed. I spend far too much time browsing source to find out how to 
do things.

>     So I want to have a box with buttons in it.  Whenever I switch
>     to a new activity, I want to press one of the buttons.  This
>     should record a stop time for what I was doing and a start time
>     for what I am about to do.  Obviously switching to another
>     project should result in selecting the "Pause" activity.
>
>     The obvious thing is to have a TimeRecorder object which has a
>     collection of activity names, a current activity, a start time
>     for the current activity, and a total time for each activity.
>     It should also hold a PluggableListMorph, which should call
> back to the TimeRecorder to get the list, the current selection,
> and to set a new selection.

Why a PluggableListMorph rather than a Morph that has some buttons in 
it? That might be easier to wire up, but...

> I know that the project-changing bit can be done, but decided to
> put off worrying about that.  The problem is that
>     - the list is transparent

It's designed to be put inside of things.

>     - the PluggableListMorph is way too big for its contents

ditto.

>     - the highlighting doesn't change; when I click on an item it
>       _is_ selected, but that doesn't show up on the screen.

That's because it's transparent.

>     - it's ridiculous for a five-element list to have a scroll-bar,
>       but I've no idea how to make it go away.

hideScrollbarIndefinitely

> I can fix the transparency by manually setting the colour,
> but surely the default background colour for a list should be
> opaque? Transparent works when you are adding a list to some other
> morph such as a Browser, which can supply the background colour. 
> It does not work when you want a free-standing list.

Why would you want one of these things by themselves when they work so 
much better with a parent?

It's super simple to make (say) a PasteUpMorph or a RectangleMorph or 
something to hold it. See the attached source code. Doit:

ListTester open.

> The bottom line is that on the day that I decided to do this, I
> _was_ able to do it, but met with some frustration on the way.  In
> retrospect, the problems mostly stem from a single cause:
>
>     Most system uses of PluggableListMorph want to drop a list into
>     a specified portion of an existing window, but I wanted a
>     free-standing list.

But you wanted the wrong thing. Since the PLM wasn't designed to be 
used by itself, you're giving yourself a big headache by trying to do 
so. There's no advantage to using a PLM by itself.

It doesn't need to be in a window; a RectangleMorph is an adequate 
parent/background.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
-------------- next part --------------
'From Squeak3.2gamma of 15 January 2002 [latest update: #4917] on 15 July 2002 at 7:58:56 pm'!
Model subclass: #ListTester
	instanceVariableNames: 'sel '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'People-nk-demo'!

!ListTester methodsFor: 'as yet unclassified' stamp: 'nk 7/15/2002 19:55'!
getList
	^(1 to: 30) collect: [ :n | 'This is item ', n asString ]! !

!ListTester methodsFor: 'as yet unclassified' stamp: 'nk 7/15/2002 19:43'!
getSelection
	^sel! !

!ListTester methodsFor: 'as yet unclassified' stamp: 'nk 7/15/2002 19:39'!
initialize
	sel _ 1.! !

!ListTester methodsFor: 'as yet unclassified' stamp: 'nk 7/15/2002 19:55'!
openList
	| p lm |
	p _ RectangleMorph new
		color: Color white;
		borderWidth: 2;
		extent: 200 at 300;
		layoutInset: 20 at 20;
		borderColor: Color black;
		layoutPolicy: TableLayout new. 
	lm _ PluggableListMorph on: self list: #getList selected: #getSelection changeSelected: #setSelection:.
	lm hResizing: #spaceFill;
		vResizing: #spaceFill;
		borderWidth: 0;
		hideScrollBarIndefinitely.
	p addMorphFront: lm.
	p openInWorld.
! !

!ListTester methodsFor: 'as yet unclassified' stamp: 'nk 7/15/2002 19:43'!
setSelection: s
	sel _ s.
	self changed: #getList! !

"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!

ListTester class
	instanceVariableNames: ''!

!ListTester class methodsFor: 'as yet unclassified' stamp: 'nk 7/15/2002 19:46'!
new
	^super new initialize! !

!ListTester class methodsFor: 'as yet unclassified' stamp: 'nk 7/15/2002 19:47'!
open
	^self new openList! !


More information about the Squeak-dev mailing list