Bungee Logic : Schema : Field

Page Status: Beta

Back to Bungee Logic

Contents

Description

Declares a new member field in the specified class. A field (also called a data member) is an encapsulation of data within a class or object. When you add fields to a class, they are displayed in the Solution Detail (fields and classes are part of the Model code).

Syntax

access type name [= value]; {OnInit{} OnChange{}}

Where:

access

is one of: public, protected, private, or internal.

Public makes the class visible from all classes, protected and, private are unused, and internal makes the class visible only to the containing project.

Note Currently, only internal access modifers are accepted for fields.

type Is the type you declare the field to be; for example, a string or an int.
name Must be a name unique within the class. The typical naming convention in Bungee is to use camel case, for example: firstName.
value The optional initialization value.

Logic

 The simplest form of a field declaration appears like this.

[+] public string firstResponse;

 

 Use the Default Value property to set an initial value to the field.

[+] public string firstResponse='No Response';

 

 You can use the [+] icon to see the intrinsic functions and add code to them if desired.

[-] public string firstResponse='No Response';

{

   [-] OnInit

   {

      // Your code here

   }

   [-] OnChange

   {

      var Data oldValue;

      // Your code here

   }

}

 

Error Handling

-None-

Intrinsics

Functions

  • OnInit — Executed when the field is first created at runtime. Similiar to a C++ constructor.
  • OnChange —Executed when the value of the field changes at runtime.

Variables

  • oldValue — Used to store the previous value of a field.

Properties

General Tab

  • Access Modifier — Specifies the field's visibility.
  • Adapter List — Specify a list of form and/or function adapters.
  • Default Value — A site that determines the value that the field is initialized with. For priimitive types like string, boolean, and int, the site should usually be a Data. For objects, the site should usually be an Object so that an actual runtime object gets created for the field (unless the field is meant to be a reference to another object).
  • Enumeration — For setting value/display pairs for when the field is bound to something like a combo box.
  • Is Collection — If selected, creates a the field as a collection of the type you declared the field to be.
  • Is Map — Toggles the class member field as a Map containing key-value pairs.
  • Is Persistent — Saves the field value in an associated Datasource.
  • Name — The name of the field. This must be unique to the class.
  • Nullable — Set the field to null when the class is constructed, or to allow a null argument to be passed to a function.
  • Type — The type of the field. To change the type of the field from the default of string, select the field statement, and select the ellipsis button for the Type property on the Property Editor. The type selection dialog will appear that will allow you to select from the available types for the current project. To access the default types available in the Runtime, select the project->Dependencies->Runtime->Types project in the type selection tree.

Behavior Tab

See Also

Runtime Type : Meta : Field
Adding a Field to a Class


Log in if you would like to rate this page.
    Copyright © 2005 - 2007 Bungee Labs. All rights reserved.