Modes: an introduction

Central to StrongEDs flexibility, are the Modes. A Mode is basically a collection of configuration options which tells StrongED how to behave. For instance you can have a traditional blue background while editing BASIC, and a white one for everything else.

A more subtle configuration is the definition of a 'word'. When you doubleclick on a word in BASIC, you want it to recognize "ABC%" and "XYZ$" as special words, whereas in C you would only want the "ABC" and "XYZ" part marked.

Modes are completely user definable. If a mode doesn't do what you want, you can change it, or you can even make a completely new one. But Modes are extremely powerful, so although some such changes are very simple, extremely complex definitions ar ealso possible!

ModeWhen Files

ModeWhen files are the key to the power of the modes. These define which mode to use for a text which is to be loaded, based on its pathname and filetype (and possibly also on its content). With a ModeWhen file, you can say that all text files in a directory called "C" should use the C mode, or that all BASIC files should use the BASIC mode.

Organising the Modes menu

newfiler/png newfilec/png newfilel/png There are many modes available for or supplied with for StrongED. Some of them will be used often, some only occasionally and some probably never.
The mode for creating a new file is chosen from a menu which lists all available modes. To prevent this Modes menu from getting too large, a sub-menu exists called 'Extra modes' at the bottom of the Modes menu. Rarely used modes can be moved here so that the main Modes menu only shows those modes that are often used.
Unused modes can, of course, be deleted entirely when they will not appear on the menu.

To move a mode from the main Modes menu to Extra modes menu there are two methods (one is introduced with 4.7):

  1. Global method: Alter the ModeLock file. To do this click Ctrl-Select over StrongED's iconbar icon, this will load the ModeLock file. Or you can load it from Mode Choices -> Misc -> Mode security.

    The first column of the ModeLock file shows the list of modes. The second column shows if a mode is in Extra modes or not, a 'Y' means yes and an 'N' means no. To move a mode to Extra modes simply change the 'N' to a 'Y'.

    Do this for all the modes that you want in Extra modes, then save the file. When next you open the Modes menu it should be updated.

  2. Local method: (New in the development version 4.70.) From the Modes's -> Open Choices menu. Press Menu in a window of the mode you wish to alter. Bottom of this menu is the Mode's name which opens a menu where you will find Open Choices...
    choices.png
    The Mode Security box changes the ModeLock file for this mode only.

Deleting or Adding Modes

In the stable version, 4.69, all known modes are supplied in !StrongED.Defaults.Modes. Most users wil not need all modes. It is quite safe to delete unwanted Modes, or to move them somewhere else.

StrongED automatically removes modes it cannot find from the ModeLock file. If you add a mode, either to !StrongED.Defaults.Modes or to !StrED_cfg.UserPrefs.Modes, StrongED will automatically add it to the ModeLock file.

You may also find it less confusing to move most modes to !StrED_cfg, StrongED. They do not need to be in two places!

The BaseMode mode

This is the main mode. *Everything* is defined here. Other modes merely define what they want to be different from the basemode. Also, some things can *only* be in the basemode (Most notably the keyboard bindings for dialogue boxes)

The BASIC and BasAsm mode

The BASIC mode is meant for editing BASIC files, and the BasAsm mode is for editing BASIC Assembly files. Neither mode has anything to do with the conversion to and from tokenised BASIC; That is something StrongED always does when the filetype is &FFB, even if it is edited in, say, BaseMode.

The reason there are two separate modes, is because the syntax of assembly and basic is rather different. One example is the ";" character. In BASIC this is used in PRINT statements. In assembly it denotes that the rest of the line is a comment.

shift-F2Lists all functions and procedures
F10Runs the file
shift-F10First saves and *then* runs the file
ctrl-GGo to PROC/FN or label
shift-PgUpGo to previous PROC/FN or label
shift-PgDownGo to next PROC/FN or label

Other relevant pages

Top of page


Page Information

http://css.torrens.org/valid-html401-bluehttp://css.torrens.org/valid-css Document URI: http://stronged.torrens.org/man/modes/intro.html
Page first published Thursday 31st of May 2018
Last modified:Mon, 03 Sep 2018 11:59:22 BST
© 2018 - 2018 Richard Torrens.