livecode.com
  • Home
  • Download
  • Developers
  • Academy
  • Community
  • Store
  • Support
  • About
LiveCode Lessons » Getting Started with LiveCode Development » Using Fields

Topics

  • Before you start 2
    • The Structure of a LiveCode Application
    • The LiveCode Message Path
  • Basic Concepts 7
    • Adding Objects to a Stack
    • Navigating Around a Stack
    • LiveCode Properties
    • Scripting a Button
    • Communicating with the User
    • Working With Text
    • Reading and Writing to File
  • LiveCode Objects 8
    • Using Buttons and Default Buttons
    • Using Fields
    • Using Radio Buttons
    • Using Option Menus
    • Text in the Tab Panel
    • Using Progress Bars
    • Using Images
    • Using Players
  • Building a User Interface 2
    • Using Button Icons and Background Images
    • Using Visual Effects
  • Building a Standalone Application 1
    • Building Standalone Applications
  • Your first LiveCode Application 1
    • Hello World! 3 ways
  • The next step - Creating a 3-5-7 Game 3
    • Game 3-5-7 - A Simple Interface
    • Game 3-5-7 - Basic Functionality
    • Game 3-5-7 - Game Logic

Last Updated

Oct 11, 2011

Download Lesson PDF

Other Resources

  • Getting Started with LiveCode

  • Get Up and Running with LiveCode
  • Getting Started with LiveCode Development
  • LiveCode Concepts

  • Features, concepts and aspects of LiveCode
  • LiveCode Lessons

  • How To - Step-By-Step Guides To Tasks In LiveCode
  • How To - LiveCode Server Tasks
  • How To - LiveCode Mobile Tasks
  • How To - LiveCode Sample Scripts
  • How to - LiveCode Marketplace Products
  • How to Purchase and License LiveCode
  • Tutorials

  • Creating a Video Library Application
  • Data Grid

  • LiveCode Data Grid
  • Data Grid Tips & Tricks
  • Converting the Stock Program

Comments

0 for this lesson

  • Prev: Using Buttons and Default Buttons
  • Next: Using Radio Buttons

Using Fields

This tutorial describes how to use the different types of LiveCode fields to enter and display text.

Introduction

Fields allow you to display text in your application. You can also use fields to allow the user to enter and edit text or make selections.

Fields support multiple fonts, styles and colors and can display a basic subset of HTML and RTF text.

Field Types

There are 5 basic field types in LiveCode, all of which you can add to your stack from the Tools Palette.

1. Label field: a single line, non-editable field
2. Text entry field: a single line, editable field
3. Scrolling field: a multi line, scrollable, editable field
4. Basic table field: a basic table field allowing data to be displayed in cells
5. Scrolling list field: a multi line, scrollable, non-editable field allowing the user to make single or multiple selections

All these objects are really the same type, they are just templates with different properties set to give different appearance and behavior. For example you could add a basic text entry field to your stack and by setting the appropriate properties turn it into a scrolling list field.

Label, Text Entry and Scrolling fields

The first 3 field types are very similar, label fields cannot be edited by the user but the others can. The only difference between a text entry field and a scrolling field is that a scrolling field is larger and has its vertical scrollbar turned on.

The Contents of a Field

You can put text into a field by typing into it directly, using the 'Contents' pane of the field Property Inspector or by setting the text property of the field in script.

You can retrieve the contents, or a portion of the contents, of a field using the get or put command. You can use chunk expressions with fields to retrieve a portion of the text, for example:

put word 1 of field "text"

For more details on using chunk expressions see this lesson.

Table Fields

Zoom

Table fields allow you to display data in cells, and optionally allow the user to edit the cells. Table fields are ideal for displaying basic tabular data. For more complex data display requirements we recommend you use the Data Grid control.

You move between cells in a table field by clicking in a cell or using the tab and return keys. Setting the text property of a table field to tab delimited data inserts the data into the relevant cells.

A field is made into a table field by turning on the Basic Table object option in the Property Inspector.

List Fields

List fields allow you to display a set of choices. Users cannot edit list fields.

You can allow the user to select multiple lines by setting the multipleHilites property to true and allow them to select lines that do not appear together by setting the noncontiguousHilites to true. Both these properties are available in the Basic Properties pane of the Property Inspector of the field.

To check which line or lines are selected use the hilitedLines property, this returns the line number of the selected line, in this example the value of the hilitedLines property would be 1,4.

You can also set the hilitedLines property to hilite lines in the list field.

Display Properties of Fields

You can set the text color, size and font of fields. You can also set the background color and hilite color of a field.

These properties allow you to give fields a highly customized appearance within your application.

  • Prev: Using Buttons and Default Buttons
  • Next: Using Radio Buttons

Comments (0)

Add your comment

E-Mail me when someone replies to this comment
Brought to you by RunRev Ltd, Registered in Scotland, No. SC200728