Squeak Class Documentation category index | class index  
 
CrosticPanel
  category: Morphic-Games
  superclass: WordGamePanelMorph
  subclasses:

The CrosticPanel, as its name suggests, is a tool for decoding acrostic puzzles, such as are presented on the puzzle pages of some Sunday newspapers. Much of the capability is inherited from the two WordGame classes used. To try it out, choose newMorph/Games/CrosticPanel in a morphic project, or execute, in any project:

CrosticPanel new openInWorld

The instance variables of this class include...
letterMorphs (in superclass) a collection of all the letterMorphs in this panel
quote a string, being the entire quote in uppercase with no blanks
clues a collection of the clue strings
answers a collection of the answer indices.
For each answer, this is an array of the indices into the quote string.

The final structure of a CrosticPanel is as follows
self a CrosticPanel the overall holder
quotePanel a CrosticQuotePanel holds the grid of letters from the quote
cluesPanel an AlignmentMorph holds most of the clue rows
cluesCol2 an AlignmentMorph holds the rest of the clue rows

Each clue row is a horizontal AlignmentMorph with a textMorph and another alignmentMorph full of the letterMorphs for the answer.

instance methods
  events
  highlight:
keyCharacter:atIndex:nextFocus:
lostFocus

  initialization
  breakColumnAndResizeWithButtons:
quote:clues:answers:quotePanel:

  menu
  addMenuItemsTo:hand:
buttonRow
clearTyping
openFile
showErrors
showHelpWindow
showHintsWindow

  parts bin
  initializeToStandAlone

class methods
  as yet unclassified
  includeInNewMorphMenu
new
newFromFile:
oldStyle
sampleFile

  parts bin
  descriptionForPartsBin

instance methods
  events top  
 

highlight:


 

keyCharacter:atIndex:nextFocus:

Override with actual response


 

lostFocus


  initialization top  
 

breakColumnAndResizeWithButtons:

The column of clues has been laid out, and the crostic panel has been resized to that width and embedded as a submorph. This method breaks the clues in two, placing the long part to the left of the crostic and the short one below it.


 

quote:clues:answers:quotePanel:


  menu top  
 

addMenuItemsTo:hand:

override with actual menu items


 

buttonRow


 

clearTyping

Clear out all letters entered as a solution.


 

openFile


 

showErrors


 

showHelpWindow


 

showHintsWindow


  parts bin top  
 

initializeToStandAlone

Set up the receiver, created by a #basicNew and now ready to be initialized, as a fully-formed morph suitable for providing a graphic for a parts bin surrogate, and, when such a parts-bin surrogate is clicked on, for attaching to the hand as a viable stand-alone morph. Because of historical precedent, #initialize has been expected to handle this burden, though a great number of morphs actually cannot stand alone. In any case, by default we call the historical #initialize, though unhappily, so that all existing morphs will work no worse than before when using this protocol.


class methods
  as yet unclassified top  
 

includeInNewMorphMenu

Return true for all classes that can be instantiated from the menu


 

new

NOTE: Use newFromFile: rather than new to create new CrosticPanels


 

newFromFile:

World addMorph: CrosticPanel new


 

oldStyle

return true if we should cross-index all the cells (takes more space).


 

sampleFile

If you want to enter a new acrostic, follow this format exactly with regard to CRs and the like, and store it in a file. Do not double the string quotes as here -- that is only because they are embedded in a string. Finally, compress the file in the fileList (so it will be easy to transport and hard to read), and name it 'yourName.crostic' so that the 'open' button on the panel will recognize it.


  parts bin top  
 

descriptionForPartsBin

If the receiver is a member of a class that would like to be represented in a parts bin, answer the name by which it should be known, and a documentation string to be provided, for example, as balloon help. When the 'nativitySelector' is sent to the 'globalReceiver', it is expected that some kind of Morph will result. The parameters used in the implementation below are for documentation purposes only!