Squeak Class Documentation category index | class index  
 
CRChar
  category: Genie-Engine
  superclass: Object
  subclasses:

This class represents a genie character.

Originally, characters were real characters (one single ascii character), but now, a character is much more general.

Basically, there are 3 different types of characters:

- Sequence of character (keystrokes) [type = #strokes]:
This category consists of any character sequence not starting with
a #. Sequences starting with a # can be entered by enclosing them inti ''.
(e.g. '#keystrokes' instead of #keystrokes)

- Command [type = #command]:
A command is basically a symbol.
Commands are used to tell the target Morph to do certain actions.
There are a lot of predefinied commands available (#inspectLastGesture, #switchCase,
#inspectDictionaries, etc.). But new commands can be added all the times.

- Code [type = #code]:
A genie character can contain any kind of Squeak code.
The format to enter a code character is the following: #Header#Code, whereas
Code is general Squeak code and Header is a descriptive string that can be omitted.
(Example: '#beep#Smalltalk beep' or just: '##Smalltalk beep').
When the gesture assigned to the code character is recognized, a MorphicGestureEvent
is sent to the target Morph. Then the entered code gets executed with the
MorphicGestureEvent as the receiver.

In each case, the contents of the character is stored in the instance variable 'string'.

instance methods
  accessing
  codeString
correspondingKeystrokes
correspondingMouseEventsHand:position:buttons:
correspondsToKeystrokes
correspondsToMouseEvents
evaluateCodeIn:
headerString
headerString:
normalized
string
string:
type

  comparing
  <
<=
=
>
>=
hash
species

  printing
  printOn:

  testing
  isCode
isCommand
isStrokes

class methods
  instance creation
  string:

instance methods
  accessing top  
 

codeString

Return the code string of the character


 

correspondingKeystrokes

Return the keystrokes corresponding to the characters.


 

correspondingMouseEventsHand:position:buttons:


 

correspondsToKeystrokes

Does the character correspond to a sequence of keystrokes?


 

correspondsToMouseEvents

Does the character correspond to a mouse event


 

evaluateCodeIn:

Evaluate the code represented by the character with the given CRGesture as
the receiver


 

headerString


 

headerString:


 

normalized

Return the normalized character.
If the character typ is #strokes, this is usually just the instance variable string.
However, if '' are used to escape #, return the string without ''.
If the type is #code, return the whole code string including a possible header.
If the type is #command, return the command as a symbol


 

string


 

string:


 

type

Type of the character: #code, #command or #strokes


  comparing top  
 

<


 

<=


 

=

Answer whether the receiver and the argument represent the same
object. If = is redefined in any subclass, consider also redefining the
message hash.


 

>


 

>=


 

hash

Answer a SmallInteger whose value is related to the receiver's identity.
May be overridden, and should be overridden in any classes that define =


 

species

Answer the preferred class for reconstructing the receiver. For example,
collections create new collections whenever enumeration messages such as
collect: or select: are invoked. The new kind of collection is determined by
the species of the original collection. Species and class are not always the
same. For example, the species of Interval is Array.


  printing top  
 

printOn:

Append to the argument, aStream, a sequence of characters that
identifies the receiver.


  testing top  
 

isCode

Is the character Squeak code (e.g. #beep#Smalltalk beep)


 

isCommand

Is the character a command (e.g. #inspectLastGesture)


 

isStrokes

Is the character a sequence of real characters (keystrokes) (e.g. Hello)


class methods
  instance creation top  
 

string: