Neobook Tip: Using Additional Shortcut Keys

Contributed by Sam Cox:

THE FOLLOWING IS NOT FOR THE FAINT OF HEART

BEFORE PERFORMING ANY OF THE FOLLOWING, MAKE SURE YOU HAVE BACKED UP YOUR PUB'S SOURCE CODE.

In the Shortcut Key field of some object types (e.g., button), NeoBook does not allow you to assign certain keys as shortcuts. You can get around this limitation by editing the object's source code directly in your ASCII editor.

CAUTION: Editing NeoBook source code by hand may result in non-functioning or even improperly function code.

CAUTION: Editing NeoBook source code by hand must be done with a pure ASCII editor. Do not use Microsoft Word or any other word processor that may add formatting codes.

To edit an object in an ASCII editor, highlight the object in NeoBook's development environment and press Ctrl-C to copy the object to the clipboard. Switch to your ASCII editor and press Ctrl-V to paste the object into the editor.

Here, for example, is the source for a simple button object -- everything between but not including the dashed lines.

-----
{NeoBook Objects}
ObjectType=3
Name=PushButton3
X=100
Y=-80
W=80
H=30
Text=Shift Tab
Align=2
Key=13
ImageStyle=0
ObjAction=Gosub "MySubroutine"¶
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=6
-----

Notice the "Key=13" line. If you have defined a shortcut key for the object, there will be a line such as this in the object's source code. You can edit the value assigned to "Key" to redefine the assigned key.

The "Key" value that appears in the source code is based on the ASCII character set. If no shift keys (SHIFT, CTRL, ALT) are associated with the shortcut, then the key value is just the ASCII value of the key. In the above example, the "13" in "Key=13" is the ASCII value for "carriage return" and is interpreted by NeoBook as the ENTER key.

If one or more shift keys (SHIFT, CTRL, ALT) are associated with the shortcut, numbers representing the particular shift key(s) are added to the ASCII value.

The shift key adders are:

32768 = ALT
16384 = CTRL
8192 = SHIFT

For example, to redefine my button's shortcut key from ENTER to SHIFT+ENTER, I replace "Key=13" with "Key=8205" where 8205 = 8192+13.

I could also define the shortcut key as "Key=24589" (CTRL+SHIFT+ENTER) = 16384+8192+13.

After editing the object's source code, highlight the object's entire block of code in your editor, press Ctrl-C to copy it to the clipboard, switch back to the NeoBook development environment, delete the original object, and press Ctrl-V to paste the edited object into NeoBook.