Newbie Q: Creating Forms from an Array
Tim Olson
tim at jumpnet.com
Fri Jul 10 04:48:44 UTC 1998
Hi, Gary:
>How does one create a Form from an array as opposed to reading from a
>file? This is for a new interface design for Halo using small bitmaps
>placed in a different order to replace the colored Ellipses.
I assume what you want to do is create a representation of a Form that
you can store in initialization code, as opposed to storing in an
external file. For that, most of the work is already done for you with
Form>>storeOn: e.g.:
String streamContents: [:strm | form storeOn: strm]
will return a string that can be read back into Squeak to recreate the
form; note that this string uses fromArray:
You can then paste this string into your initialization code, so that it
looks something like:
initialize
form1 := (Form
extent: 256 at 256
depth: 16
fromArray: #( 1610244090 1610244090 1610244090
1610244090 1610244090 1610244090 1610244090
1610244090 1610244090 1610244090 1610244090
1610244090 1610244090 ....
-- tim
More information about the Squeak-dev
mailing list
|