Skip to main content
Engineering LibreTexts

2.9: Keyboard Shortcuts

  • Page ID
    39727
    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    If you want to evaluate an expression, you do not always have to right click. Instead, you can use keyboard shortcuts shown in menu items. Even though Pharo may seem like a mouse driven enviroment it contains over 200 shortcuts that allow you operate a variety of tools, as well as the facility to assign a keyboard shortcut to any of the 80000 methods contained in the Pharo image. To have a look at the available shortcuts go to World Menu > System > Keymap Browser.

    Depending on your platform, you may have to press one of the modifier keys which are Control, Alt, and Command. We will use CMD in the rest of the book: so each time you see something like CMD-d, just replace it with the appropriate modifier key depending on your OS. The corresponding modifier key in Windows is CTRL, and in Linux is either ALT or CTRL, so each time you see something like CMD-d, just replace it with the appropriate modifier key depending on your OS.

    In addition to Do it, you might have noticed Do it and go, Print it, Inspect it and several other options in the context menu. Let’s have a quick look at each of these.

    Doing vs. printing

    Type the expression 3 + 4 into the playground. Now Do it with the keyboard shortcut.

    Do not be surprised if you saw nothing happen! What you just did is send the message + with argument 4 to the number 3. Normally the resulting 7 would have been computed and returned to you, but since the playground did not know what to do with this answer, it simply did not show the answer. If you want to see the result, you should Print it instead. Print it actually compiles the expression, executes it, sends the message printString to the result, and displays the resulting string.

    Select 3+4 and Print it (CMD-p). This time we see the result we expect.

    3+4
    >>> 7
    

    We use the notation >>> as a convention in this book to indicate that a particular Pharo expression yields a given result when you Print it.

    The Inspector.
    Figure \(\PageIndex{1}\): Inspecting a simple number using Inspect.

    Inspect

    Select or place the cursor on the line of 3+4, and this time Inspect it (CMD-i).

    Now you should see a new window titled ”Inspector on a SmallInteger(7)” as shown in Figure \(\PageIndex{1}\). The inspector is an extremely useful tool that allows you to browse and interact with any object in the system. The title tells us that 7 is an instance of the class SmallInteger. The top panel allows us to browse the instance variables of an object and their values. The bottom panel can be used to write expressions to send messages to the object. Type self squared in the bottom panel of the inspector, and Print it.

    The inspector presents specific tabs that will show different information and views on the object depending on the kind of object you are inspecting. Inspect Morph new openInWorld you should get a situation similar to the one of Figure \(\PageIndex{2}\).

    Other operations

    Other right-click options that may be used are the following:

    • Do it and go additionally opens a navigable inspector on the side of the playground. It allows us to navigate the object structure. Try with the previous expression Morph new openInWorld and navigate the structure.
    • Basic Inspect it opens the classic inspector that offers a more minimal GUI and live updates of changes to the object.
    • Debug it opens the debugger on the code.
    • Profile it profiles the code with the Pharo profile tool which shows how much time is spent for each message sent.
    • Code search offers several options provided by System Browser, such as browsing the source code of an expression, searching for senders and implementers, and so on.
    The Inspector on a Morph.
    Figure \(\PageIndex{2}\): Inspecting a Morph using Inspect.

    This page titled 2.9: Keyboard Shortcuts is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.