Integrated Rapid Development Environment

Fast, Efficient, and Error-free Code Development

The SheerPower Integrated Rapid Development Environment (IDE) SmartCopy feature greatly speeds up the writing of error-free SheerPower 4GL programs. SmartCopy does this by intelligently copying, pasting, and replacing code. By default, SmartCopy operates on the single line of code above the cursor. But, if a SmartCopy command is preceded with a slash ("/"), the SmartCopy command operates on the entire paragraph of code above the cursor. See more on how to use SmartCopy in the Smart Copy and Paste chapter in the documentation.

Usually, the Smart Key is [CTRL+ENTER] (while holding down the Ctrl key, press ENTER).

To set up SmartCopy in SPDEV click on Options in the menu, then choose Keystroke Function Mappings.

Next, place a check in the box by CONTROL and then click on the ENTER key on the keyboard map. Then click on MAP THIS KEY. A list of functions to map is shown. Choose "SmartCopy", click on "Map it", and then "Save and Exit". You are ready to use the SmartCopy feature.

To use the SmartCopy feature, you:

  • Move the cursor directly under a line or paragraph of code (a snippet).
  • Enter a SmartCopy command and press [CTRL+ENTER] to invoke the command.
  • SmartCopy commands can be as simple as a single field name.

For example:

my_city$ = payroll(city) 
zipcode CTRL+ENTER

SmartCopy sees the word "zipcode", assumes that it is a field name, and scans the line above for a pattern of "(*)". It finds "(city)", and marks the word "city" as the TARGET and "zipcode" as the replacement text. SmartCopy then duplicates the entire line, and changes all occurrences of "city" to "zipcode". When the change is made, SmartCopy also preserves the upper/lower case of the text.

To explicitly give the target and the replacement text, use the format of: 

target = replacement

For example:

city = zipcode [CTRL+ENTER] 

If you are generating a series of lines based on a single line of code above the cursor, you can give multiple replacement values separated by commas. For example:

my_city$ = payroll(city) 
state,zipcode,country [CTRL+ENTER]

This generates three new lines of text:

my_state$ = payroll(state) 
my_zipcode$ = payroll(zipcode) 
my_country$ = payroll(country)

And, another example, this time duplicating OPEN statements:

open structure payroll: name '@..\data\payroll', access outin 
payroll = client, membership, audit [CTRL+ENTER]

This generates three new OPEN statements:

open structure client : name '@..\data\client', access outin 
open structure membership: name '@..\data\membership', access outin 
open structure audit: name '@..\data\audit', access outin

SmartCopy also allows for the rapid correction of text through replacement. For example, we incorrectly entered "fullname" and should have entered instead "client_name":

my_fullname$ = payroll(fullname) 
 .fullname = client_name[CTRL+ENTER]

The leading DOT (".") says that we are doing an "in place" replacement of text. The result is:

 my_client_name$ = payroll(client_name) 

All SmartCopy commands can be applied to an entire paragraph of code. A leading slash ("/") means to apply the SmartCopy command to the entire paragraph above the cursor. For example:

 audit(type) = 'CITY' 
 audit(value) = payroll(city) 
 do_the_audit 
 /city = state, zipcode[CTRL+ENTER]

This produces two new paragraphs of code:

 audit(type) = 'STATE' 
 audit(value) = payroll(state) 
 do_the_audit

 audit(type) = 'ZIPCODE' 
 audit(value) = payroll(zipcode) 
 do_the_audit 

Notice also in this example the preservation of case for the uppercase text.

SmartCopy can also be used to duplicate one or more lines of text -- with or without replacements. The TICK MARK ("`"), under the tilde on the far left top of most keyboards, tells SmartCopy that you want text duplicated. The value after the tick mark is the number of duplicates requested..up to 99.

For example, to make four duplicates of empty HTML table cells in this paragraph of HTML code:

 <tr>
<td>
</td>
 </tr>
/`4 [CTRL+ENTER]

To just duplicate one line of code a few times:

print '------' 
`3 CTRL+ENTER

Produces:

 print '------'<< this is the original line 
print '------' 
print '------' 
print '------'