<< Previous Suneido > Contents > User Interfaces > ReferenceNext >> 
Methods

RecordControl

(control)

A PassthruController that tracks the contents of its controls in a record.

RecordControl's default name is "Data".

A RecordControl "mirrors" the contents of the controls it contains. Changing the values in the RecordControl will update the contents the controls. Similarly, when the contents of the controls are changed (by the user) the values in the RecordControl will be updated.

For example:

Window(Controller
    {
    Controls: 
        #(Record
            (Vert
                (Field name: city)
                (Field name: country)
                Skip
                (Horz
                    (Button Canada) Skip
                    (Button Home) Skip
                    (Button City) Skip
                    (Button Inspect) Skip
                    (Button Protect))))
    On_Canada()
        {
        .Data.SetField('country', 'Canada')
        }
    On_Home()
        {
        .Data.Set(#{city: 'Saskatoon', country: 'Canada'})
        }
    On_City()
        {
        Alert(.Data.GetField('city'))
        }
    On_Inspect()
        {
        Inspect(.Data.Get())
        }
    On_Protect()
        {
        control = .Data.GetControl('city')
        control.SetReadOnly(not control.GetReadOnly())
        }
    })

To work with RecordControl controls must register by sending a "Data" message, must send "NewValue" when it's value changes (usually when it loses the focus), and must support Get(), Set(value), and Dirty?(dirty) methods.


<< Previous Suneido > Contents > User Interfaces > ReferenceNext >> 
Copyright (C) 2000-2007 Suneido Software Corp. All rights reserved worldwide.