Window with buttons

Tim Olson tim at jumpnet.com
Mon Feb 2 20:40:01 UTC 1998


>- is there any way to set the button's size so that it does not cover the
>window's entire area?
>
>- how do you juxtapose several buttons in the same window?
>
>- how do you tell Squeak to give the buttons a border?
>
>(Basically, what I am trying to do is figure out how to create basic user
>interface items in a window).
>
>Many thanks.

Here's a little snippet that might help you see how to do these things.  
Also, you might want to look at Morphic, where you can do all this 
graphically.


| topView textView text button |
topView := StandardSystemView new
	backgroundColor: Color lightBlue;
	borderWidth: 2;
	label: 'Button Switchbox';
	minimumSize: (300 at 200);
	maximumSize: (300 at 200).
text := 'Hello, World!' asDisplayText.
textView := DisplayTextView new
	model: text;
	window: (0 at 0 extent: 40 at 8);
	borderWidth: 2.

0 to: 15 do:
	[:i |
	button := SwitchView new
		model: Switch new;
		label: (i printString asParagraph);
		borderWidth: 2;
		window: (0 at 0 extent: 8 at 4);
		foregroundColor: Color red;
		backgroundColor: Color yellow.
	topView addSubView: button
		align: button viewport topLeft
		with: ((i \\ 4) * 10) @ ((i // 4)+1 * 10)].
topView addSubView: textView.
topView controller open.



     -- tim





More information about the Squeak-dev mailing list