The context menu

BASin

The context menu

The context menu appears when you right-click the program listing in the editor.

When using the editor, it can be useful to get help with a codeword or things with a variable. BASin allows you to click your right mouse button within the Editor which will bring up the a menu. Depending upon what you were pointing at when you clicked, the menu will give you different options. Bear in mind that if you bring up the menu for a variable, it must have been given a value by the LET codeword before it will be recognised by BASin.

Codewords

These options are available when you select a codeword (such as PRINT).

Token Help

Opens the Spectrum BASIC manual at the entry for that codeword.

Tokenise

The Spectrum character set includes a single character, called a token, for each codeword. It is possible (but never necessary) to include a token in a string. This command converts the selected keyword to its token, indicated in the program listing by a very tiny value, that can be made of letters or numbers.

Note: If you need to store a token in a string, it is usually better to use the CHR$ codeword.

You can also tokenise entire strings by using the "String Operation" menu when right-clicking on them.

De-Tokenise

Converts a token, represented by its tiny-text value, back to the original codeword. When called from the "String Operation" Menu, when a string literal has been right-clicked, you can un-tokenise an entire string.

Find Line

Any codeword which requires a line number as it's parameter such as RUN, GO TO, GO SUB etc, where the line number is present will have this option available. Using this, you can jump to the line number indicated by the parameter. This also applies to line numbers that are calculated, i.e. GO TO 5+5 will move the editor cursor to line 10. As this is evaluated, you can use any Sinclair BASIC expression to specify the line number. This also applies to FOR variables, which will allow you to jump to the loop point (the statement directly after the FOR statement). This will not find the relevant NEXT statement line, as you can use more than one NEXT for a FOR statement.

Variables

These commands are available when you select a variable.

Note: The context menu only recognises variables that are already present in memory. This means that a variable must have been declared (using a DIM or LET statement) before it will show up in the context menu.

Edit Variable

Opens the Variables window for the selected variable, so that you can change its value.

String Wordwrapping

These options are available from the "Wordwrap String" when you activate the menu on a long string - that is, one that is longer than 32 characters.

Wordwrapping is useful when a string has to be printed to the screen, but is too long to fit into the standard 32 character wide display. By default, the text would flow over the edge of the screen, cutting off halfway through a word if necessary:

10 PRINT "This is a very long string and will wrap"

Will display as

This is a very long string and w
ill wrap

Clearly, this looks unacceptable. So instead, there are word wrapping options available for these strings on the Context-Menu.

Split at 32 Chars - This option will split your string into many strings, seperated by the ' character (the line-feed PRINT item). The split will occur at the first space charecter before the point where the split would occur normally.

Hence, our long string now looks like this in code:

10 PRINT "this is a very long string and"'"will wrap"

Insert Spaces - This option will, instead of splitting the string, insert space characters before any words that will be split to force them over the 32 character boundary. Having applied this method, our line of code now looks like this:

10 PRINT "this is a very long string and  will wrap"

Note the extra space between "and" and "will". This makes sure that the word "will" begins on a new line. It does however make your lines even longer.

Standard commands

These commands are always available on the context menu.

Cut

Removes the selected text (if any) and places a copy on the windows clipboard. The clipped text is converted to .bas format, so any control characters in the text, or tokens from the Spectrum ASCII set will be converted to escape characters.

Copy

Copies the selected text (if any) to the Windows system clipboard in text format. As with the Cut operation, the text will be converted to .bas format before being placed on the clipboard.

Paste

Inserts any text found on the Windows system clipboard into the program at the current cursor position. The text will be processed for .bas format escape codes, and then will be inserted using one of two methods:

If the text contains no Return (CHR$ 13) characters, then it will be inserted as one line.

If the text contains more than one line, then the Add Code Window will be shown, with the clipboard text in the edit field as plain text. You can edit this text to your liking, and it will then be tested for syntax validity before being inserted line by line into your program. If any of the lines will overwrite any current program lines, then (assuming that you have enabled Line Overwrite Protection in the relevant Options Window page) BASin will warn you with the option to abort the operation, ignore the line, or replace the old line in the program.

Debug

This submenu provides access to common debugging features.

  • Toggle Breakpoint creates or removes a breakpoint at the editor cursor position.
  • Run to Line runs the program and pauses at the statement indicated by the edit cursor.
  • Go to Line runs the program from the line and statement at the edit cursor position.
  • Watch Variable If the context menu is called for a variable, you can Watch the variable as program execution runs. The watch will be added by opening the Watch Properties window, which will be pre-filled with data about the variable.