Tools Notepad/en

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen

Introduction[Bearbeiten]

Workspaces ("Notepads") are simple text-editor windows which can also evaluate code. These can be used to prepare or inspect test-data, texts and similar. They also provide a calculator and scripting-language capability: you can type in an expression (expressed as Smalltalk or JavaScript code fragment) and evaluate it. Finally, they can be used as "PostIt-Note", to remember fragments of text or code.

Workspaces are very useful to compute test-vectors, hex- or binary numbers or to generate string data, which can be copy-pasted into a freeze-value, an attachment or (using the File Browser) into a file.

The following screenshot displays a script/code fragment being evaluated:

Notepad1.png

The most useful functions are "DoIt", "PrintIt" and "InspectIt";
all of which evaluate the selected text as a code fragment. If no text is selected, the current cursor line is evaluated.

"PrintIt" will paste the result into the notepad and "InspectIt" will open an inspector (data viewer) on it. Finally, "DoIt" will simply evaluate it, but do nothing with the result.

All of these functions are found in the toolbar AND in the context menu (right button menu).
There are also convenient keyboard shortcuts "CTRL-d" for DoIt, "CTRL-p" for PrintIt and "CTRL-q" for InspectIt". InspectIt shows the result object's internal state (i.e. its private slots) and its class; so you can take a look at the methods (functions) which are provided by the object.

Multiple Tabs[Bearbeiten]

Workspaces support multiple tabs. Click on the "Add Page" button in the toolbar or one of the "Pages" menu functions, to get another tab.

Timer Functions[Bearbeiten]

There is also a Stopwatch and an AlarmTimer found in the Tab-Page menu. Use them for simple measuring tasks, or to get a timed feedback (for example, to get reminded of something to do or check during a long running test-task). The Alarm-Timer can be configured to ring after a time-period or at a final alarm time (good as a tea-timer !).

Snippet Management[Bearbeiten]

All text editors inside expecco share a common snippet database. Snippets are little text fragments which can be quickly pasted into any text editor by pressing some abbreviation followed by ALT-SPACE. For example, a programmer who often needs the string "self" to be typed in, might want to attach the word "self " to the snipplet-abreviation "s" and get the full string via "s"-ALT-SPACE. A number of predefined snippets (mostly for programmers) can be found and managed in the snippet manager. You may want to customize them according to your domain's requirements.

Collecting Text from Various Places[Bearbeiten]

A very common task is to collect text-fragments via copy-paste from various places (such as different input fields of a tested GUI application) and place them as a single line collection into a freeze-value, attachment or other string-field. The "Autofetch Selection" option found in the "Edit" menu does exactly that for you: it monitors the clipboard, and appends every copied string (from any other application) into the workspace's text area.

Sorting[Bearbeiten]

Under the editor's right-button-menu, you will find various items under "More" → "Tools" → "Sort". These operate on the currently selected line-range. For example, to sort a number of lines, select them, and apply the "Sort Lines" function.

Generating Unique IDs[Bearbeiten]

The right-button-menu also provides a function to generate globally unique IDs (GUIDs or UUIDs). Try "More" → "More" → "Insert new UUID"

Code Evaluation[Bearbeiten]

Workspaces include code interpreters for JavaScript and Smalltalk Code. To evaluate a piece of code, select it, and apply the "doIt" menu function. Use "printIt" to paste the result. Finally "inspectIt" will open an inspector window on the result.

For example, to compute the square-root of the number 2, type:

2.sqrt()

apply "printIt", to get the result pasted at the current text-cursor position (already selected, so you can Cut or Copy it immediately for further use).

The syntax of the interpreter can be changed via the main-menu (under the "Workspace"-item), or via the right-click-menu in the lower-right syntax indicator field. Notice that the syntax-indicator field's visibility can be controlled via the "View"-menu's "Show Info" item. You may have to turn it on first.

The above example works when "JavaScript" is set as syntax. With Smalltalk syntax, you would have to enter:

2 sqrt

Physic/Math Language[Bearbeiten]

When switching to the "Physic/Math" language, you can enter mathematical and physical expressions like:

10 Ω * 5 A

or equations like:

x^2 + 3x = 4

Workspace math.png

More Features[Bearbeiten]

The expecco Notepad as described here is a somewhat stripped-down version of the full Smalltalk-Workspace application. It has smaller menus and less functions as the full featured version, in order to be more "beginner friendly".

You will find many more features (text-filters, variables, languages etc.) in this application, which can be opened via:

Smalltalk.WorkspaceApplication.open()

or (if you prefer Smalltalk), with:

Smalltalk::WorkspaceApplication open

or by changing the default notepad in the "Settings" → "Internal Tools" dialog to "Smalltalk".

See Also[Bearbeiten]

The workspace's full documentation is part of the official Smalltalk/X Online Documentation.

 


Back to Online Documentation.
Back to Tools.



Copyright © 2014-2024 eXept Software AG