| Previous | Contents | Index |
INPUT DIALOGBOX supports a subset of standard HTML tags along with dialogbox enhancements. For a complete listing of supported HTML tags refer to Appendix G, Input Dialogbox--supported HTML tags.
9.4.1 SheerPower Tag - <sheerpower>
The SHEERPOWER TAG is a powerful feature of INPUT DIALOGBOX. The SheerPower tag allows you to change the size, color and title of a form as well as other attributes. In addition, the SheerPower tag includes a TYPE attribute which specifies the type of dialog box to be presented. The different types are: HTML FORM (default), OPEN, SAVEAS, and SELECT.
When using the HTML form type the SheerPower tag must be the first tag used before the FORM tag.
| Example 9-6 <sheerpower > tag |
|---|
form$ = '<sheerpower color=red height=500 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$
for item = 1 to pieces(results$, chr$(26))
z0$ = piece$(results$, item, chr$(26))
varname$ = element$(z0$, 1, '=')
value$ = element$(z0$, 2, '=')
select case varname$
case 'name'
print 'Name: '; value$
case 'address'
print 'Address: '; value$
case 'city'
print 'City: '; value$
case 'state'
print 'State: '; value$
case 'country'
print 'Country: '; value$
case else
print '??: '; varname$
end select
next item
end
|
| Attribute | Function |
|---|---|
| color | specify the background color of the form |
| background | specify a .JPG image to be used for the form background |
| title | specify the title of the form |
| height | specify the height of the form (in pixels) |
| width | specify the width of the form (in pixels) |
| src | specifies location of a URL or local file to grab HTML form tag code from (URL must contain only form HTML code) |
| persist | keeps background canvas, text and images in place when form autosubmits (no blinking screen) |
| autosubmit | automatically submits form after specified seconds of inactivity |
| type (HTML form/open/saveas/select) | opens the Open, Saveas or Select dialogbox |
| attached | 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. |
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> |
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> |
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\news.spsrc" 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 |
| Previous | Next | Contents | Index |