The supergettext statement will display a dialog with a text entry area.
Parameters
This statement has two parameters:inputtext – Field or variable where user’s input will be placed.
options – This parameter may contain one or more options that alter the operation of the dialog. See the description below for more information.
Description
This statement will display a dialog with a text entry area. You can control the size of the dialog, as well as several appearance options. If the dialog has more than one button, info(“dialogtrigger”) will contain the name of the button that was pressed. Here is an example showing how this statement can be used:
supergettext Address,{caption="Enter full address" height=50% width=4in buttons="Open;Cancel"}
The supergettext statement allows you to display a wide variety of dialogs without having to do any graphics work at all. Of course if you need even more customization you can always create any style you want using a form and the rundialog statement.
The second parameter of the supergettext statement is a list of options. This list uses a syntax similar to an HTML tag to specify one or more options. Each option is specified as an option=value pair, for example height=300
, title="Enter Quantity"
, etc. Values aren’t required to be quoted unless they contain spaces or special punctuation characters. (Tip: If you enclose the entire option parameter in pipes, curly brackets or “smart quotes” you will be able to use regular " quotes for the individual options, if necessary.)
The sections below describe each of the available supergettext options.
If you don’t specify otherwise the dialog will be 70 points high and 500 points wide, but you can specify any dimensions you want. By default the dimensions are specified in points (one point = 1/72 inch). This example specifies an alert that is 2 inches high and 4 inches wide.
supergettext Label,{height=144 width=288}
You can also specify the dimensions in inches ("
or in
) or centimeters (cm
), or as a percentage. See the superalert statement for details.
Use the title=
option if you want to display a title at the top of the dialog (in the title bar).
supergettext CardNumber,{title="Please enter your card number"}
Use the caption=
option if you want to display a title just above the text (in the body of the dialog window, not in the title bar).
supergettext CardNumber,{caption="Please enter your card number"}
The caption is normally one line high, but you can make it bigger.
supergettext CardNumber,
{caption="Please enter your card number
(MasterCard or Visa)" captionheight=2}
You can also change the font, size, style and color of the caption.
supergettext CardNumber,{caption="Please enter your card number"
captionfont="Palatino" captionsize=14 captioncolor="#999999"}
If the field or variable being edited contains text before the dialog is opened, you can control how that text is initially selected using the textselect=
option. This example places the insertion point at the end of the text.
local AreaCode
AreaCode="909"
supergettext AreaCode,{textselect=end}
This example places the insertion point at the beginning of the text.
supergettext AreaCode,{textselect=start}
This example selects all of the text (this is the default setting).
supergettext AreaCode,{textselect=all}
Use the buttons=
option to specify up to two buttons (the default is: Ok and Cancel). Each button is separated by a semicolon, and the first button listed is the default button.
supergettext phonenumber,{buttons="Add;Cancel"}
if info("dialogtrigger")="Add"
... do something for add
elseif info("dialogtrigger")="Cancel"
... do something for cancel
endif
The buttons will be displayed in the bottom right corner of the alert. They are displayed in reverse order. In the example above, the Add button is on the far right and is the default button. The Cancel button is displayed to its left.
The default button width is 80 points, you can also specify a button width in points by placing a colon followed by the width after the button name.
supergettext phonenumber,{buttons="Submit:120;Cancel:80"}
Normally you set up a button for cancelling the dialog (see above). However, you can also enable the dialog’s close button (the red button in the upper left corner of the dialog) to perform this function. Use the true/false closewindowbutton=
option to do this.
supergettext phonenumber,{ ... closewindowbutton=yes ... }
Normally the dialog’s maximization button (the green button in the upper left) is enabled, allowing the user to click to “zoom” the dialog to maximum size. If you want to disable this option, use the maximizablewindow=
option, like this:
supergettext phonenumber,{ ... maximizablewindow=no ... }
The edited text normally appears in the standard system font, but you can change the font, size and color. This example changes the edited text to be blue 15 point Tekton.
supergettext phonenumber,{font=Tekton size=15 color="#0000FF"}
The style options include bold
, italic
and bolditalic
. The color is specified using HTML color notation (2 hex digits each for red, green and blue).
Note that the text itself doesn’t have any style or color – it’s just plain text. It is only displayed using these attributes while it is being edited.
If the text to be edited might be really long, you can add a scroll bar to your dialog.
supergettext warandpeace,{height=80% scroll=yes}
Or, you can use a thin scroll bar.
supergettext warandpeace,{height=80% scroll=thin}
The dialog normally has a light gray background. Use the bgcolor=
option to specify a different color using HTML color notation (for example blue
or #0000FF
. This example uses a white background.
supergettext phonenumber,{bgcolor=white}
You can set up default supergettext options for a window, a database, or globally. To do so, simply define a variable named SuperGetTextDefaultOptions
that contains the options. This example will set up a default alert font of Helvetica 12.
fileglobal SuperGetTextDefaultOptions
SuperGetTextDefaultOptions = {font="Helvetica" size=12}
Once this code is run, all supergettext dialogs run while this database is active will default to Helvetica 12. (Of course the default can be overridden by explicitly including the options in the supergettext option list.
See Also
History
Version | Status | Notes |
10.0 | No Change | Carried over from Panorama 6.0. |