Value - DfBaseList

Gets and sets the data value (content) for an object or item

Type: Property

Access: Read/Write

Data Type: String

Parameters: Integer iItem

ParameterDescription
iItem (Optional)Item number. Optional for any class with only one entry_item. (0-based)


Syntax
 Property String Value

Read Access: Get Value [iItem] to StringVariable
Write Access: Set Value [iItem] to StringVariable/Value


Description

Each item and Entry_Item has a value. The value is displayed when the object is painted and the item is in the visible portion of the screen. The value is stored as a string. If the item number (iItem) is out of range, the operation is ignored. The screen is updated to reflect the new value of the item.

Use

Set Value to "Some String"
Get Value to sStringVariable


Sample

This sample shows how to augment the Activate method to conditionally set the Value of the object (e.g. a Form) if it is currently blank. Since a Form object only has one item (item 0), it does not have to be passed.

Procedure Activate Returns Integer
    String sValue
    
    Forward Get msg_Activate to iRetVal
    
    Get Value to sValue
    if (sValue = "") ;
        set Value to "Type Name here"
    
    Procedure_Return iRetVal
End_Procedure


List-Based Classes

Each cell in a grid/list is an item. A grid can have 0 to many items. Item references are 0-based. The Form_DataType and Form_Mask properties set the type of the value (number, string, integer etc). The Form_Margin property determines the number of characters a user can enter in the cell. Before an item can be referenced, it needs to be created.

Samples:

If a grid has 3 columns and you want to add the following information (stored in an array of structs):

"ABC", "ABC Corp", 100000
"DEF", "DEF Corp", 200000
"XYZ", "XYZ Corp", 400000

You can use:

Procedure DoFillGrid tsCustomer[] sCustomer
    Integer iCustomers iCustomer
 
    Move (SizeOfArray (sCustomer)) To iCustomers
    For iCustomer From 0 To (iCustomers-1)
        Send Add_Item msg_None sCustomer[iCustomer].Code
        Send Add_Item msg_None sCustomer[iCustomer].Name
        Send Add_Item msg_None sCustomer[iCustomer].Budget
    Loop
End_Procedure


The array of customer information is passed to the procedure with:

Send DoFillGrid sCustomer


Getting the name of the second customer can be done with:

Get Value 4 to sCustomerName

Or

Get Value (iCustomer * 3 + 1) to sCustomerName