[squeak-dev] Help with ImageSegments

Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Fri May 1 19:02:44 UTC 2009

On 5/1/09 1:23 PM, "Brent Pinkney" <brent at zamail.co.za> wrote:

> Hi,
> I would like to use image segments in 3.9.
> I need to export a tree of objects to a file and then load the segment into a
> different image.
> Thanks
> -- 
> Brent

>From SqueakLightII, you have the attached .st.
So you could have MyTree saveOnFileNamed: 'OakTree'.

SqueakLightII could read this and also autoopen a Inspector of any .obj file
via drag and drop.

For other images without the SLII logic, you must do

|  inputStream anObject |
inputStream _ FileStream oldFileNamed: ' OakTree.obj'.
    anObject _ inputStream fileInObjectAndCode.
    inputStream close.
(Inspector openAsMorphOn: anObject) openInHand

You must know this sure works between same version images , like two
different 3.9 based images , but could fail between different images, as
3.10 as example don't have some classes 3.9 have.

SLII have in development logic for you could load "missed classes" from
server via DNU.

I hope this helps


-------------- next part --------------
'From SqueakLight|II of 31 May 2008 [latest update: #7217] on 22 April 2009 at 10:15:12 am'!

!Object methodsFor: 'objects from disk' stamp: 'edc 9/5/2008 08:57'!
saveOnFileNamed: aString 
	"Ask the user for a filename and save myself on a
	SmartReferenceStream file. Writes out the version and class structure.
	The file is fileIn-able. UniClasses will be filed out.
	This save objects as .obj"
	| aFileName fileStream |
	aString isEmpty
		ifTrue: [^ Beeper beep].
	aFileName := ('my {1}' translated format: {self class name}) asFileName.
	"do better?"
	aFileName := aString , '.obj'.
	fileStream := FileStream newFileNamed: aFileName asFileName.
	fileStream fileOutClass: nil andObject: self! !

More information about the Squeak-dev mailing list