Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Search for a symbol or string in all objects
Last updated at 12:14 pm UTC on 10 October 2019

Searching for a symbol value

Search for the occurence of #swapMouseButtonsChanged in instance variable of all objects in the image:

 searchSymbol := #swapMouseButtonsChanged.
 resultObjects := OrderedCollection new.

 SystemNavigation default allObjectsDo: [:obj |
       1 to: obj class instSize do: [:i | |val|
               val := obj instVarAt: i.
               val isSymbol ifTrue: [
                       val = searchSymbol ifTrue: [resultObjects add: obj]]]].

Source: Marcel Taeumel, Mar 07, 2016, Squeak Dev Mailing List

Searching for a string value


 searchTerm := 'birthday'.
 resultObjects := OrderedCollection new.

 SystemNavigation default allObjectsDo: [:obj |
       1 to: obj class instSize do: [:i | |val|
               val := obj instVarAt: i.
               val isString ifTrue: [
                       (val includesSubstring: searchTerm) ifTrue: [resultObjects add: obj]]]].
 resultObjects explore

See also