Sheerpower®
A Guide to the Sheerpower Language


Previous Contents Index

9.4.1.1 Sheerpower Tag Attributes - COLOR, HEIGHT, WIDTH, TITLE

The Sheerpower tag allows you to manipulate the color, height and width of an HTML form. Percentages can also be specified for height and width instead of pixels. For example:


  <sheerpower title="This is MY form!" color="green" height="50%" width="75%"> 

You can also use the title attribute to insert a title in the form.

Example 9-7 <sheerpower > Tag Attributes: COLOR, HEIGHT, WIDTH, TITLE

  form$ = '<sheerpower title="This is MY form!" color="green" height="400" width="500">' 
  form$ = form$ + '<form>' 
  form$ = form$ + 'Name <input type=text name=name><br>' 
  form$ = form$ + 'Address <input type=text name=address ><br>' 
  form$ = form$ + 'City <input type=text name=city><br>' 
  form$ = form$ + 'State <input type=text name=state><br>' 
  form$ = form$ + 'Country <input type=text name=country><br>' 
  form$ = form$ + '</form>'
  input dialogbox form$: results$ 
  end

9.4.1.2 Sheerpower Tag Attribute - BACKGROUND

This example illustrates the BACKGROUND attribute to the <sheerpower> tag where any .JPG image file can be used as the dialogbox form background.

Example 9-8 <sheerpower > Tag Attributes - BACKGROUND

  form$ = '<form>' 
  form$ = form$ + '<sheerpower background="sheerpower:samples\woodpecker.jpg">' 
  form$ = form$ + '</form>' 
  input dialogbox form$: ans$ 
  end

9.4.1.3 Sheerpower Tag Attributes - SRC

The next example illustrates the SRC attribute. Using the SRC attribute inside the <sheerpower> tag allows you to take the existing HTML code between <form></form> tags from a file located on your local machine and use it inside your program. Note the syntax used to locate the file when using the SRC attribute.

Example 9-9 <sheerpower > Tag Attributes - SRC

  form$ = '<sheerpower src="file://c:\sheerpower\samples\src_form.html">' 
  input dialogbox form$: response$ 
  end

9.4.1.4 Sheerpower Tag Attributes - AUTOSUBMIT

The AUTOSUBMIT attribute lets you automatically submit a form after a specified number of seconds of inactivity. The following example illustrates the use of the AUTOSUBMIT attribute to the Sheerpower tag.

Example 9-10 <sheerpower > Tag Attributes - AUTOSUBMIT

  form$ = '<sheerpower autosubmit="5">' 
  form$ = form$ + '<form>' 
  form$ = form$ + 'You have 5 seconds to type in the correct answer ' 
  form$ = form$ + 'to this skill testing question:<p> Who was the seventh ' 
  form$ = form$ + 'president of the United States of America? ' 
  form$ = form$ + '<input type=text name=answer>' 
  form$ = form$ + '</form>' 
  input dialogbox form$: skill$ 
  print skill$ 
  end

9.4.1.5 Sheerpower Tag Attributes - AUTOSCALE

The AUTOSCALE attribute is used to dynamically adjust the fontsizes for the end-user so that the dialogbox looks like the one that the programmer designed.


  <sheerpower autoscale=true> 

9.4.1.6 Sheerpower Tag Attributes - ATTACHED

The ATTACHED attribute causes the resulting dialogbox window to be "attached" to the SP4GL Console Window (when there is some console output). If the console window is minimized or restored, the attached dialogbox window will minimize or be restored with it.


  <sheerpower attached> 

9.4.1.7 Sheerpower Tag Attributes - TYPE

The TYPE attribute enables you bring up the OPEN, SAVEAS or SELECT dialog box. The dialogbox is used to get the list of files from the user, but does not perform any processing on the files.

The DEFAULT PATH can be any location specified as shown in the examples below.

You can choose which file types to display in the dialog boxes by using a filter:


  input dialogbox '<sheerpower type=xxx filter="filter_string">': f$ 

The filter_string will look like:


  filtername = spec,spec,spec; filtername=spec2,spec2 

When writing a program that opens a dialog box for the user to select a file you must also check to see if the user selects the [Cancel] button. The way to check if a user clicked on CANCEL or closed the dialogbox window is:


  if _exit then print 'they closed the window or clicked on cancel' 

Example 9-11 <sheerpower > Tag Attributes - TYPE FILTER

  path$ = "c:\sheerpower" 
  filter$ = "Sheerpower source=*.spsrc,*.spinc"
  input dialogbox '<sheerpower type=open filter=' + 
                  quote$(filter$) +'>', default path$: f$ 

9.4.1.8 Specifying a Root-Level for the Browsing of Files

To specify a root-level for the BROWSING of files as well as a default file name, use the following syntax:


  input dialogbox '<sheerpower type=open>', default xxx$: f$ 

Where xxx$ can be a specific file path with or without the file name and extension.

Example 9-12 <sheerpower > Tag Attributes - TYPE =OPEN

  pathfile$ = "c:\sheerpower\samples\" 
  input dialogbox '<sheerpower type=open>', default pathfile$: f$ 
  end

Example 9-13 <sheerpower > Tag Attributes - TYPE =SAVEAS

  input dialogbox '<sheerpower type=saveas>': f$ 
  end 

Example 9-14 <sheerpower > Tag Attributes - TYPE =SELECT

  select_file$ = "c:\sheerpower\" 
  input dialogbox '<sheerpower type=select>', default select_file$: f$ 
  end 

9.4.2 Form Tags

9.4.2.1 FORM

<form>. . . </form>

The FORM tag defines an input form.

Example 9-15 <form >... </form > Tag

  form$ = '<form>' 
  form$ = form$ + 'Name <input type=text name=name ><br>' 
  form$ = form$ + 'Address <input type=text name=address ><br>' 
  form$ = form$ + 'City <input type=text name=city><br>' 
  form$ = form$ + 'State <input type=text name=state><br>' 
  form$ = form$ + 'Country <input type=text name=country><br>' 
  form$ = form$ + '</form>'
  input dialogbox form$: response$ 
  end

9.4.2.2 ANCHOR

<a>...</a>

The ANCHOR tags can be used to insert a clickable link inside a form. Clicking on the text link will open a web browser to the URL indicated inside the anchor tags.

Example 9-16 <a >... </a > Tag

  f$ = '<form><a href="http://www.cnn.com">News Link</a></form>' 
  input dialogbox f$: a$ 
  end

9.4.2.3 INPUT

<input> Tag

The INPUT tag is used to specify a simple input element inside a form. There is no terminating INPUT tag.

Example 9-17 <input > Tag

  form$ = '<form>' 
  form$ = form$ + 'Name: <input type=text name=name><br>' 
  form$ = form$ + 'Telephone: <input type=text name=telephone><br>' 
  form$ = form$ + '</form>' 
  input dialogbox form$: response$ 
  end

INPUT Tag Attributes

Table 9-2 INPUT Tag Attributes
Attribute Function
type see list below for type attributes
name symbolic name for this input field
value can be used to specify the default contents of the field; also specifies the value of a checkbox or radio button when it is checked
checked specifies that this checkbox or radio button is checked by default; this is only appropriate for checkboxes and radio buttons
size the physical size of the input field in characters
maxlength the maximum number of characters that are accepted as input
message message text displayed when hovering over input field

The TYPE attributes are:

Example 9-18 <input > Tag Attributes

  test$ = '<form>' 
  test$ = test$ + 'Male<input type=radio name=gender><br>' 
  test$ = test$ + 'Female<input type=radio name=gender checked><br>' 
  test$ = test$ + 'Place a check in this box:<input type=checkbox name=check><br>'  
  test$ = test$ + 'Name:<input type=text name=name size=10 value="Tester"><br>' 
  test$ = test$ + 'Country of residence:<input type=text name=country message="type here" size=30><br>' 
  test$ = test$ + 'Password:<input type=password name=password message="secret!" maxlength=5><br>'   
  test$ = test$ + '<input type=hidden name=test_form_only value=complete><p>' 
  test$ = test$ + '<input type=submit name=submit value="Send Info">' 
  test$ = test$ + '</form>' 
  input dialogbox test$: answer$ 
  end


Previous Next Contents Index