[squeak-dev] {'Squeak Help' . a TheWorldMainDockingBar . #squeakHelp . nil}

Eduardo Ochs eduardoochs at gmail.com
Wed Feb 1 05:21:48 UTC 2023


Hi list,

I'm trying to port to Squeak an idea that use a lot in Emacs, that is
to use one-liners as hyperlinks. There's a page with a detailed
explanation of that idea in this link,

  http://anggtwu.net/eev-squeak.html

and here goes a short explanation, and a question.

I'm working on a class called "See", and my one-liners that work as
hyperlinks always start with "See". For example, these ones

  See class: HelpBrowser.
  See class: HelpBrowser method: #accept:.
  See class: See.
  See class: See classMethod: #item1ctsa:.
  See class: See classMethod: #class:method:.
  See class: See classMethod: #class:classMethod:.

make the SystemBrowser display different pieces of information, and
these one liners

  See fileList.
  See helpBrowser.
  See messageNames.
  See methodFinder.

are equivalent to running:

  Tools -> File List
  Apps -> Help Browser
  World -> open -> message names
  World -> open -> method finder

but there are LOTS of menu entries that I don't know how to implement
as one-liners, because their "targets" are objects that I don't know
how to access from "global code"... let me explain this.

When I run "See methodFinder" it runs this: "ECToolSet
openSelectorBrowser". I discovered that the "action" associated to
"World -> open -> method finder" is "ECToolSet openSelectorBrowser" by
using the halo to duplicate the entry "method finder" in the menu
"World -> open", and then I examined the "contents", the "target", the
"selector", and "arguments" of that first item of that menu with just
one entry. Here is a visual explanation in a screenshot,

  http://anggtwu.net/IMAGES/2023-squeak-item1ctsa.png

and in that case my function that returns the fields "contents",
"target", "selector", and "arguments" of a menu item returns this:

   {'method finder' . ECToolSet . #openSelectorBrowser . #()}

When I try to do the same for "Help -> Squeak help" I get:

  {'Squeak Help' . a TheWorldMainDockingBar . #squeakHelp . nil}

note the "a"... =(

When I run this to try to find a global variable that holds an object
of the class TheWorldMainDockingBar,

  Smalltalk globals keysAndValuesDo: [:k :v |
   (v isKindOf: TheWorldMainDockingBar) ifTrue: [ Transcript show: k; cr. ]
  ].

it returns nothing. So I wrote these two methods in my class "See" to
help me find active morphs of a given class,

  --snip--snip--
  !See class methodsFor: 'other links' stamp: 'Edrx 2/1/2023 00:55'!
  worldMorphs
    "Return an OrderCollection with all the morphs whose world is non-nil.
     Test:
       See worldMorphs explore.
    "
    ^ Morph allSubInstances select: [ :m | m world notNil ].
  ! !

  !See class methodsFor: 'other links' stamp: 'Edrx 2/1/2023 00:57'!
  worldMorphs: class
    "Return an OrderCollection with all the morphs whose world
     is non-nil, and that are objects of the given class.
     Test:
       (See worldMorphs: DockingBarItemMorph) explore.
    "
    ^ Morph allSubInstances
          select: [ :m | (m world notNil) and: [m isKindOf: class] ]
  ! !
  --snip--snip--

but for the class TheWorldMainDockingBar this one-liner

  (See worldMorphs: TheWorldMainDockingBar) explore.

returned no instances...

Any suggestions?

  Thanks in advance,
    Eduardo Ochs
    http://anggtwu.net/eev-squeak.html
    http://anggtwu.net/SQUEAK/See.st.html
    http://anggtwu.net/SQUEAK/See.st


P.S.: I tried to send questions to the beginners mailing list, but
that list is kind of dead... so I tried to make my question a bit less
beginner-ish, and I am sending it here to squeak-dev...


More information about the Squeak-dev mailing list