Step 3: The Keyboard Header
Comments
c Simplified French Keyboard for Keyman 7.0
Most of the header in this example is made up of comments. A comment is used to make notes about the keyboard, or to provide information on the workings of the keyboard. The comments are readable by anyone looking at the source code of the keyboard.
A comment always starts with a lowercase 'c', followed by one or more spaces, and continues to the end of the line. Keyman Developer will ignore comments when compiling a keyboard.
Comments can take up a whole line, or can start in the middle of the line. The latter is useful for making short notes about individual lines. As you can see we have used both kinds of comments in the header.
The &Version system store
store(&Version) "7.0" c This keyboard is for use with Keyman 7.0
The &Version system store identifies the Keyman version for which this keyboard was written; this keyboard is for use with Keyman 7.0. The &Version system store is a required part of each keyboard header, and should be the first store in the file.
The &Name system store
store(&Name) "Quick French"
The &Name system store specifies a descriptive name for the keyboard, which can be up to eighty characters long. The name we have given to this keyboard is "Quick French". The &Name system store is not required but is highly recommended!
The &Bitmap system store
store(&Bitmap) "qfrench.ico"
The optional &Bitmap system store tells Keyman which image to use for the
keyboard's icon. The picture should be in the standard Windows .ICO or .BMP format,
and should be 16x16 pixels. If you use a modern icon editor, the icon can use
alpha transparency. For this keyboard we will be using the following bitmap:
; it is found in the Keyman Developer
folder, under Samples\Examples\qfrench.ico
- you should copy it into
the same folder in which you will save your keyboard.
The &MnemonicLayout system store
store(&MnemonicLayout) "1"
The &MnemonicLayout system store tells Keyman that the layout is meant to conform to the user's keyboard layout; for example, if the user presses the quote key (') on their keyboard (whether they are using a US English, UK English, French, German, Swedish, etc.) it should work in the same way. The opposite of this is a positional layout (the default), which is intended for keyboards for which there is no correspondence between what is printed on the keyboard and what is output.
The begin statement
begin Unicode > use(Main)
The begin statement tells Keyman which group of rules to process first when it receives a keystroke. The use of multiple groups is an advanced feature, and unnecessary for this tutorial, so we will use a single group, called Main. The begin statement is required in every keyboard, and marks the start of the keyboard body. A keyboard can have one or two begin statements, for Unicode and/or legacy codepage-based systems (also known as "ANSI"). We will be using Unicode.