SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

EXAMPLE:

Example 11-10 SET HELP OFF statement

  line input 'Name', length 30: reply$ 
  print _help
  set help off
  print _help
  end
 
 
Name? HELP__________________________ 
1 
0 

DESCRIPTION:

SET HELP OFF sets the internal variable _HELP to FALSE (0).

11.7 SET ICON

FORMAT:


        SET ICON 'str_exp' 

EXAMPLE:

Example 11-11 SET ICON statement

// dynamically change the taskbar icon 
 
  set icon "c:\sheerpower\samples\smiley.ico" 
  print "Check out the taskbar icon... it's a smiley!" 
  delay
  set icon "c:\sheerpower\samples\frowny.ico" 
  print "and now... it's changed to a frown!" 
  end

DESCRIPTION:

SET ICON changes the Icon displayed on the taskbar for each running SheerPower application. A unique icon can be specified for every SheerPower application. The icon can be dynamically changed during program execution.

11.8 ASK KEYSTROKES

FORMAT:


         ASK KEYSTROKES num_var 

EXAMPLE:

Example 11-12 ASK KEYSTROKES statement

  input 'Please enter your name': name$ 
  print 'Hello '; name$ 
  ask keystrokes strokes 
  print 'Keystrokes:'; strokes 
  end
 
 
Please enter your name? Maryanne 
Hello Maryanne 
Keystrokes: 8 

DESCRIPTION:

ASK KEYSTROKES asks for the number of user-entered keystrokes.

11.9 ASK | SET MARGIN

11.9.1 ASK MARGIN

FORMAT:


        ASK MARGIN num_var 

DESCRIPTION:

ASK MARGIN finds the right margin of the device specified and assigns its value to the numeric variable num_var.

11.9.2 SET MARGIN

FORMAT:


        SET MARGIN num_expr 

EXAMPLE:

Example 11-13 SET MARGIN statement

  print repeat$('.' ,200) 
  print 
  ask margin old_marg 
  input 'What do you want the margin set to': new_marg 
  set margin new_marg 
  print repeat$('.' ,200) 
  set margin old_marg 
  end
 
 
.................................................. 
.................................................. 
.................................................. 
.................................................. 
 
What do you want the margin set to? 20 
.................... 
.................... 
.................... 
.................... 

DESCRIPTON:

SET MARGIN sets the right margin on the device specified to the number indicated. num_expr specifies the column to set the margin to. The margin must be greater than zonewidth.

11.10 ASK PAGESIZE

FORMAT:


        ASK PAGESIZE num_var 

EXAMPLE:

Example 11-14 ASK PAGESIZE statement

  ask pagesize no_lines 
  print 'There are'; no_lines; 'lines or rows on this screen' 
  end
 
 
There are 24 lines or rows on this screen 

DESCRIPTION:

ASK PAGESIZE returns the number of rows or lines of screen output.

11.11 ASK RESPONSES

FORMAT:


        ASK RESPONSES num_var 

EXAMPLE:

Example 11-15 ASK RESPONSES statement

  input 'Please enter your name': name$ 
  input 'What day is this': what_day$ 
  print 'Hello '; name$ 
  print 'Have a good '; what_day$ 
  ask responses answers 
  print
  print 'Responses:'; answers 
  end
 
 
Please enter your name? Ginger 
What day is this? Wednesday 
Hello Ginger 
Have a good Wednesday 
 
Responses: 2 

DESCRIPTION:

ASK RESPONSES asks for the number of completed input responses.

11.12 SET SCROLL

FORMAT:


        SET SCROLL num_expr1, num_expr2 

EXAMPLE:

Example 11-16 SET SCROLL statement

  print at 21, 1: 'This text will not scroll.' 
  set scroll 5, 20 
  print at 20, 1:;  
  delay 1 
  print 'This'  
  delay 1 
  print 'text'  
  delay 1 
  print 'will'  
  delay 1 
  print 'scroll.'  
  delay 1 
  set scroll  1,24 
  end
 
 
 
This 
text 
will 
scroll 
 
This text will not scroll. 

DESCRIPTION:

SET SCROLL statement sets up a scrolling region from line num_expr1 to line num_expr2.

11.12.1 RANDOMIZE

FORMAT:


        RANDOMIZE 

EXAMPLE:

Example 11-17 Randomize statement

  randomize
  x = rnd 
  print x 
  end
 
run
.244013674718 
 
        
run
.524856061388 

PURPOSE:

RANDOMIZE gives the RND function a new starting point. This ensures a different random number sequence each time a program executes.

DESCRIPTION:

SheerPower uses a list of random numbers when the RND function is used. If no RANDOMIZE statement is used, SheerPower starts at the same place in this list each time the program executes. This means the same series of random numbers is returned each time the program executes.

RANDOMIZE tells SheerPower to pick a random starting point in the list. This ensures that a different series of random numbers is returned each time the program executes. (See Section 6.1.12, RND for information on the RND function.)

11.13 ASK | SET SEED

FORMAT:


        ASK SEED num_var 
        SET SEED num_expr 

EXAMPLE:

Example 11-18 ASK/SET SEED statement

  randomize
  ask seed seed_num 
  for i = 1 to 3 
    print rnd(1000) 
  next i 
  print 'Reset the random sequence' 
  set seed seed_num 
  for i = 1 to 3 
    print rnd(1000) 
  next i 
  end
 
 
608 
88 
506 
Reset the random sequence 
608 
88 
506 

PURPOSE:

ASK SEED sets or resets the pseudo-random number sequence.

DESCRIPTION:

ASK SEED returns the current starting point of a pseudo-random sequence and stores the number in num_var.

SET SEED sets the starting point of a pseudo-random sequence with the number in num_expr.

11.14 ASK | SET SYSTEM

There are a number of ASK SYSTEM and SET SYSTEM statements. These are described in the following sections. The ASK/SET statements ask about and set various system operation features.

11.14.1 ASK SYSTEM: COMMENT

FORMAT:


        ASK SYSTEM: COMMENT str_var 

EXAMPLE:

Example 11-19 ASK SYSTEM: COMMENT statement

  set system: comment 'Invoice Entry' 
  ask system: comment c$ 
  print c$ 
  end
 
 
Invoice Entry 

DESCRIPTION:

The ASK SYSTEM: COMMENT statement asks for the SheerPower operating system comment for the process.

11.14.2 SET SYSTEM: COMMENT

FORMAT:


        SET SYSTEM: COMMENT str_expr 


Previous Next Contents Index