So I'm an idiot. The answer to question 1 could be:
up with a an array full of trues and falses. Sorry for leading you down
> On 01/10/2013 07:32 AM, Frank Church wrote:
>>
>>
>>
>> Thanks for the last answer which lists all the workspaces.
>>
>> My initial desire was to label my Workspaces and then copy the contents
>> of those which match some label and organize them into a kind of
>> collection. Similar to ScriptManager.
>>
>> So essentially I want to list all Workspaces whose titles or contents
>> match a substring, parse the contents further for some criteria and put
>> those matching into a list for review. Then from there put the right
>> ones into a permanent persisted collection.
>>
>> My intention is to do something like.
>>
>> | workSpaces textMorphs |
>> workSpaces := OrderedCollection new.
>> textMorphs := TextMorphForEditView allInstances
>> select: [ :morph | (morph firstOwnerSuchThat: [ :owner |
>> (owner
>> isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
>>
>> I want to capture all the matching Workspaces into the workSpaces
>> variable, by some method such as 'workSpaces[i] := textMorphs[i]
>> getWorkspace' and get the labelString of the Workspace, but it seems
>> that firstOwnerSuchThat returns a nil or notNil, rather than the actual
>> Workspace and it also seems redundant to get the list of Workspaces into
>> the workSpaces through iterating over the textMorphs variable as the
>> owner variable in the loop captures them at some point.
>>
>> So this question breaks down into 2 parts.
>>
>> 1. How can copy add the owner if it turns out to be a Workspace to the
>> workSpaces variable inside the loop (what is syntax)
>>
>> 2. How would I write a method such as : workSpace := textMorph
>> getWorkspace, with or without using firstOwnerSuchThat, ie a general
>> method of parsing the inheritance/ownership chain.
>
>
> I recommend you read through this:
>
>
http://squeak.joyful.com/LanguageNotes>
>
> 1.
>
> workSpaces:=
>
> TextMorphForEditView allInstances
> collect: [ :morph | (morph firstOwnerSuchThat: [ :owner
> | (owner
> isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ]) notNil ]
>
>
> 2.
>
> TextMorph>>getWorkspace
> |workspace|
> workspace:= self firstOwnerSuchThat: [ :owner | (owner
> isKindOf: SystemWindow) and: [ owner model isKindOf: Workspace ] ].
> ^workspace
>
>
>
> Heres some for you:
>
> Why are you so resistant to using classes and so interested in using
> workspaces? Why invent a new way of using Smalltalk when you don't have
> the basics down pat? My point is you didn't know about #select: and you
> didn't know about #collect: but you do know that Workspaces are
> interesting and Classes and the Browser is not. Why not just put the
> contents of whatever you've got in the Workspaces into methods in a
> Classes you define and the you can call them whenever you want and
> persist them with the tools that have been developed thus far rather
> than inventing your own tooling while learning about Smalltalk.....
>
>
> Good luck
>
> Paul
>