| Previous | Contents | Index |
SET WINDOW: DATA str_expr
|
| Example 11-43 SET WINDOW: DATA statement |
|---|
clear print at 1,1: ; x$ = 'Mary had a' + chr$(10) + 'little lamb' set window: data x$ print at 10,1: 'done' end Mary had a little lamb done |
SET WINDOW: DATA statement sets the whole screen to the specified string. This is the mirror image of ASK WINDOW: DATA str_var.
11.15.8 ASK | SET WINDOW: KEYMAP
ASK WINDOW: KEYMAP str_var
SET WINDOW: KEYMAP str_expr
|
| Example 11-44 ASK | SET WINDOW: KEYMAP |
|---|
print 'Save the current keymap, reset keymap to default value.' ask window: keymap old_keymap$ set window: keymap '' print 'Changing dollar sign key to *' set window keystroke '$': value '*' line input 'Press the dollar sign key, then ENTER': e$ print 'Restore saved keymap' set window: keymap old_keymap$ line input 'Press the DOWN key': down$ line input 'Press the dollar sign key, then ENTER' : e$ end Save the current keymap, reset keymap to default value. Changing DOWN key to be the EXIT key Press the DOWN key? EXIT Changing dollar sign key to * Press the dollar sign key, then ENTER? * Restore saved keymap Press the DOWN key? Press the dollar sign key, then ENTER? $ |
ASK WINDOW: KEYMAP and SET WINDOW: KEYMAP allow a generalized routine to save the current keymap, change the meaning of keys, and then restore the original keymap when done.
ASK WINDOW: KEYMAP and SET WINDOW: KEYMAP are used to save the image of the keymap and later restore it. This is helpful for applications the meaning of the keys must be temporarily changed using the SET WINDOW KEYSTROKE statement. The keymap can be restored to its default setting with SET WINDOW: KEYMAP.
SET WINDOW KEYSTROKE str_expr1: VALUE str_expr2
|
| Example 11-45 SET WINDOW KEYSTROKE: VALUE statement |
|---|
print 'Saving the current keymap.' ask window: keymap old_keymap$ set window: keymap '' print 'Changing dollar sign key to *' set window keystroke '$': value '*' line input 'Press the dollar sign key, then ENTER': e$ print 'Restoring saved keymap.' set window: keymap old_keymap$ line input 'Press the DOWN key': down$ line input 'Press the dollar sign key, then ENTER' : e$ end Saving the current keymap. Changing DOWN key to be the EXIT key Press the DOWN key? EXIT Changing dollar sign key to * Press the dollar sign key, then ENTER? * Restoring saved keymap. Press the DOWN key? Press the dollar sign key, then ENTER? $ |
SET WINDOW KEYSTROKE changes the meaning of a keystroke within a SheerPower program. This allows complete redefinition of the keyboard for a given application.
str_expr1 describes the name of a key to be changed. It can be a single keystroke name or a comma-separated list of names. Keystroke names can be a single letter, or the name of the letter (such as [Tab], or [Ctrl/Z]).
str_expr2 defines the new meaning of the keystroke. A keystroke meaning consists of one or two components: the keystroke value and the keystroke concept. For example, the [Ctrl/Z] key usually has a value of CHR$(26), and the concept of EXIT. The keystroke value and/or the keystroke concept can be changed. If changing both a value and a concept, separate the two with a comma. You can restore the original meaning of the key by using " ".
The following keystroke concepts are supported:
| Concept name | Description |
|---|---|
| _EXIT | an EXIT key |
| _BACK | a BACK key |
| _HELP | a HELP key |
| _IGNORE | ignore this keystroke |
| _INVALID | beep when pressed |
| _TERMINATOR | keystroke is a line terminator |
ASK WINDOW: ROW num_var
|
| Example 11-46 ASK WINDOW: ROW statement |
|---|
print at 5,10:; ask window: row cur_row print 'Cursor is at row'; cur_row end Cursor is at row 5 |
ASK WINDOW: ROW statement returns the current row of the cursor's position.
SET WINDOW: ROW num_expr
|
| Example 11-47 SET WINDOW: ROW statement |
|---|
set window: row 3 print 'Hi!' end Hi! |
SET WINDOW: ROW statement positions the cursor at the num_expr row within the current column.
ASK WINDOW: TYPEAHEAD str_var
|
| Example 11-48 ASK WINDOW: TYPEAHEAD statement |
|---|
do
do_process
ask window: typeahead z$
if pos(ucase$(z$), 'STA') > 0 then show_status
if pos(z$, chr$(26)) > 0 then exit do
loop
stop
routine do_process
delay 1 //<--- simulated processing
print '.';
end routine
routine show_status
print
print 'Showing status'
set window: typeahead ''
end routine
end
....... <---- type 'STA' while dots are printing
showing status
....... [Ctrl/Z] <---- to stop, press [Ctrl] and [z]
|
ASK WINDOW: TYPEAHEAD gets data from the typeahead buffer. This statement can be used to determine, for example, whether the user has typed [Ctrl/Z] or other special keystrokes. Asking for typeahead data does not lose what is already in the typeahead buffer.
SET WINDOW: TYPEAHEAD str_expr
|
| Example 11-49 SET WINDOW: TYPEAHEAD statement |
|---|
set window: typeahead 'FRED' + chr$(13) input 'Name': name$ print name$ end Name? FRED FRED |
SET WINDOW: TYPEAHEAD puts data into the typeahead buffer as though the user had typed the data in from the terminal.
11.16 ASK | SET ZONEWIDTH
11.16.1 ASK ZONEWIDTH
ASK ZONEWIDTH num_var
|
| Example 11-50 ASK ZONEWIDTH statement |
|---|
ask zonewidth x print 'The current print zone width is'; x end The current print zone width is 20 |
ASK ZONEWIDTH finds the print zone width of the device specified and assigns the value to the numeric variable, num_var.
SET ZONEWIDTH num_expr
|
| Example 11-51 SET ZONEWIDTH statement |
|---|
print 1,2,3
set zonewidth 10
print 1,2,3
set zonewidth 20
end
1 2 3
1 2 3
|
| Previous | Next | Contents | Index |