Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

EXAMPLE:

Example 11-42 ASK SYSTEM, SYMBOL 'OS:xxx': VALUE Statement

 
  ask system, symbol 'os:path': value mypath$ 
  print 'The path value is: '; mypath$ 
  end
 
 
The path value is: c:\windows;c:\windows\system32;C:\Sheerpower\

DESCRIPTION:

The os: prefix to a symbol says that we are referencing the OPERATING SYSTEM SYMBOL. In the case of WINDOWS, this is the COMMAND window symbol.

11.15.20 ASK SYSTEM: USER

FORMAT:


        ASK SYSTEM: USER str_var 

EXAMPLE:

Example 11-43 ASK SYSTEM: USER Statement

  ask system : user uname$ 
  print 'User is: '; uname$ 
  end
 
 
User is: Default 

PURPOSE:

ASK SYSTEM: USER statement returns the operating system name or ID for the user.

11.16 ASK | SET WINDOW

There are various ASK WINDOW and SET WINDOW statements. These are described in the following sections. The ASK/SET WINDOW statements ask about and reset different screen features.

11.16.1 ASK WINDOW AREA

FORMAT:


        ASK WINDOW AREA row, col, row, col: DATA str_var 

EXAMPLE:

Example 11-44 ASK WINDOW AREA Statement

  print at 10, 4: 'Mary had a'; 
  print at 11, 4: 'little lamb'; 
  ask window area 10, 4, 11, 15: data x$ 
  print
  print x$ 
  end
 
 
   Mary had a 
   little lamb 
Mary had a 
          little lamb 

DESCRIPTION:

ASK WINDOW AREA statement reads the text displayed on the screen within the area defined by the given upperleft/lowerright coordinates into a string variable, str_var. The coordinates are specified by upper-left row, upper-left column, lower-right row, lower-right column. The statement returns a <LF> delimited string. No screen attributes are stored.

11.16.2 SET WINDOW AREA

FORMAT:


        SET WINDOW AREA row, col, row, col: DATA str_expr 

EXAMPLE:

Example 11-45 SET WINDOW AREA statement

  x$ = 'Mary had a' + chr$(10) + 'little lamb' 
  set window area 6, 5, 7, 15: data x$ 
  end
 
 
 
    Mary had a 
    little lamb 

DESCRIPTION:

SET WINDOW AREA statement sets the screen within the area defined by the given upperleft/lowerright coordinates to the specified string. This is the mirror image of ASK WINDOW AREA row, col, row, col: DATA str_var.

11.16.3 ASK WINDOW: COLUMN

FORMAT:


        ASK WINDOW: COLUMN num_var 

EXAMPLE:

Example 11-46 ASK WINDOW: COLUMN Statement

  print at 5,10:; 
  ask window: column cur_col 
  print 'Cursor is at column'; cur_col 
  end
 
 
Cursor is at column 10 

DESCRIPTION:

ASK WINDOW: COLUMN statement returns the current column of the cursor's position.

11.16.4 SET WINDOW: COLUMN

FORMAT:


        SET WINDOW: COLUMN num_expr 

EXAMPLE:

Example 11-47 SET WINDOW: COLUMN Statement

  print at 5,10:; 
  set window: column 4 
  print 'Hi!' 
  end
 
 
    Hi! 

DESCRIPTION:

SET WINDOW: COLUMN statement positions the cursor at the num_expr column within the current row.

11.16.5 ASK | SET WINDOW: CURRENT

FORMAT:


        ASK WINDOW: CURRENT str_var 
        SET WINDOW: CURRENT str_var 

EXAMPLE:

Example 11-48 ASK | SET WINDOW: CURRENT

  print at 1,20, blink: 'Sample screen' 
  do
    line input 'Name', at 5,1, length 30: name$       
    if  _back or  _exit then exit do
    if  _help  then
      ask window: current old_w$ 
      clear area box: 1, 5, 10, 50 
      print at 3, 10, reverse: 'This is some help' 
      delay
      set window: current old_w$ 
      repeat do
    end if
  end do
  end
  
  
                     Sample screen 
                     
                     
               Name? help___________________            <------- type in 'help' 
 
 
 
            +--------------------------------------------+ 
            |                                            | 
            |    This is some help                       | 
            |                                            | 
        Name|                                            | 
            |                                            | 
            |                                            | 
            +--------------------------------------------+ 
 
 
                        Press the ENTER key to continue 

DESCRIPTION:

ASK WINDOW: CURRENT and SET WINDOW: CURRENT saves the image of the current screen and later restore it easily. This is useful for help messages and menus, where you must temporarily change the screen and then restore it back to what it was.

11.16.6 ASK WINDOW: DATA

FORMAT:


        ASK WINDOW: DATA str_var 

EXAMPLE:

Example 11-49 ASK WINDOW: DATA Statement

  print at 10, 4: 'Mary had a'; 
  print at 11, 4: 'little lamb'; 
  ask window: data x$ 
  print
  print x$ 
  end
 
 
   Mary had a 
   little lamb 
. 
. 
. 
 
Mary had a 
            little lamb 

DESCRIPTION:

ASK WINDOW: DATA statement reads the text displayed on the whole screen into a string variable. The statement returns a <LF> delimited string. No screen attributes are stored.

11.16.7 SET WINDOW: DATA

FORMAT:


        SET WINDOW: DATA str_expr 

EXAMPLE:

Example 11-50 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 

DESCRIPTION:

SET WINDOW: DATA statement sets the whole screen to the specified string. This is the mirror image of ASK WINDOW: DATA str_var.

11.16.8 ASK | SET WINDOW: KEYMAP

FORMAT:


        ASK WINDOW: KEYMAP str_var 
        SET WINDOW: KEYMAP str_expr 

EXAMPLE:

Example 11-51 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? $ 

PURPOSE:

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.

DESCRIPTION:

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.


Previous Next Contents Index