Back to Text Objects
Up to Table of Contents
Ahead to Timer Objects

Text Field Objects

Text Field objects allow you to display editable text in your applications. This can be text that you provide or it can be text that the user types. If the object's MultipleLines property is set to True, the object displays with scrollbars. Use the Text Field object tool to draw a Text Field. The tool appears as follows:

Note: Text Field objects are editable at runtime. If your application requires display-only Text, consider using a Text object or consider incorporating the text into a graphic.

Text Field Object Appearance

There are two ways to enter text in a Text Field object. You can set the object's Filename property to an ASCII text (. txt) file. Or, you can set the object's Text property. When you click in the Value field for the Text property, Jamba displays the Text Properties dialog box where you can type in the characters you want to display. When you click on OK, the text is automatically returned to the Value field.

The Font property controls the character size and style used by the object and the TextColor and BackgroundColor properties control the colors.

As mentioned previously, if the object's MultipleLines property is set to True, the object uses scrollbars.

Interactivity

Typically, a user interacts with a Text Field object in one of the following ways:

  • You can set up the Text Field object's To Do List so that one or more types of interactions trigger an event. For example the user can trigger a Complete event by pressing Return, or trigger a GetFocus or LoseFocus event when the user tabs to or from the object. Also, a LoadComplete event can be triggered when a text file finishes loading into the object.
  • The object itself can trigger a Create event when it is first created or it can trigger a Show or Hide event when it first comes into or out of view, respectively, via the Visible property.
  • The Text Field object can have one or more of its properties or methods set when another object is affected. For example, the user can click on a Push Button to change the Visible property of the Text Field object to True.

    For more information on available events, see the section entitled "Text Field Object Properties, Methods, and Events."

    Capturing the User's Input

    As mentioned previously, you have the ability to pre-set a Text Field object by setting its Text or its Filename property. Similarly, when a user types in a Text Field at runtime, its Text property is set to the text that the user types. In effect, the application uses the Text property to "capture" the user's input. Your application can use this information to set another property or method at runtime.

    If you want to manipulate the captured value, you refer to it using the Object.Property syntax. For example, if you want to manipulate the value currently stored in the Text property of TextField1, you would specify the value TextField1.Text.

    Acting on the User's Input

    There are two ways to use a value captured in the Text property. The first method does not use CGI and the second does. The following two subsections describe how to use the Text Field object with and without using CGI programming.

    Text Field Objects without CGI

    An application can use the value captured by the Text property to set another property that uses the kind of value that the user typed. For example, consider an application that uses TextField1 and Text1. You can instruct the user to type his or her name in TextField1 which captures that information in the Text property. You can then set the Text property of Text1 using TextField1.Text. This redisplays the user's name elsewhere on the page.

    Text Field Objects with CGI

    By using a CGI object to call a CGI program, you can greatly enhance the power of Text Fields in your applications. When a user types a value, you can send the Text property out to a CGI program. The CGI program can evaluate the information and return information that sets a property or method of an object.

    For example, an application can let a user enter a resort name which is then sent to a CGI program. The CGI program evaluates the name and sends back information that causes a Text object to display a text file on the specified subject. The application uses TextField1, CGI1 and Text1. The following paragraphs describe how the various objects are set up.

    TextField1 - The Text and Filename properties are initially not set so that the object is empty. The user is instructed to enter a resort name and press Return. Pressing Return triggers a Complete event. The To Do List for the Complete event is set up to run the CGI object.

    CGI1 - The ParameterList property would be set to send TextField1.Text (which equals the name of a resort). The Response property would be set to True so that the CGI object expects return information. The CGI program is coded to determine which resort has been specified. It returns the name of the text file to display in Text1, using the syntax Text1.Filename= "filename.txt".

    Text1 - The Text object is empty until its Filename property is set by the CGI object.

    For more information, see the section entitled "CGI object."

    Lesson: Text Field Objects

    In this lesson you set up Text Field object so that when the user types his or her name and presses Return, the information is redisplayed in large bold characters in a Text object at the top of the page.

    • Start a new project and open the StartPage.

    • Draw a TextField object (called TextField1) and two Text objects (called Text1 and Text2).

    • Resize and position the objects so they are similar to the following:

    First set up Text1 so that it tells the user to enter his or her name.

    • Right click on Text1 and choose Properties... from the popup menu.

    • Set the Text property to Enter your name and press Enter:

    Now you'll set up Text2 so that when it redisplays the user's name, it uses the appropriate font information.

    • Click on Text2 to display its properties.

    • Click in the Value field for the Font property to display the Font dialog box. Set the font to a large size (around 24 pt.) and bold. Set the Color to Blue. Click on OK to close the Font dialog box.

    Finally, you set up the TextField object. First, you'll set the object's MultipleLines property to False so that the user can only type on one line. This also causes the object to appear without scrollbars.

    • Click on TextField1.

    • Set the MultipleLines property to False.

    Now you'll set the object's To Do List so that when the user finishes typing and presses Enter, the text will redisplay in Text1.

    • Click on the To Do List tab.

    The event is set to Complete which is appropriate for this lesson.

    • Leave the event set to Complete.

    • Click on the New To Do Item button.

    • Choose Text2 from the Object drop-down list.

    • Set the What To Do field for Text2 to Text. Then set the Value to TextField1.Text.

    When the user types a name and presses Return, the To Do List uses TextField1.Text to set Text2's Text property.

    • Save and run the application.

    Text Field Object Properties, Methods, and Events

    Text Field objects support the following properties, methods, and events:

    Properties Methods Events
    BackgroundColor MoveAndSize() Complete
    Enabled SlideTo() Create
    FileName
     
    GetFocus
    Font
     
    Hide
    Height
     
    LoadComplete
    HowToHide
     
    LoseFocus
    HowToShow
     
    Show
    MultipleLines
     
    SlideToComplete
    Name
     
     
    Text
     
     
    TextColor
     
     
    Visible
     
     
    Width
     
     
    X
     
     
    Y
     
     

    Back to Text Objects
    Up to Table of Contents
    Ahead to Timer Objects