Skip to content

Class: FormExternalControl [Abstract]

Properties | Events | Methods | Index of Classes

Abstract class enabling applications to provide users with a visual control to 'slide' through a range of values

Hierarchy

cObject > cUIObject > DfBaseObject > DfBaseWindow > DfBaseUIWindow > DfBaseControl > DfBaseList > DfBaseForm > Form > FormExternalControl

Show full hierarchy and direct subclasses

Library: Windows Application Class Library

Package: ExtFrm.pkg

Description

FormExternalControl is used to enable applications to provide users with a visual control to 'slide' through a range of values.

The purpose of the class is to allow developers to create their own controls that exhibit Form-like or dbForm-like behaviour. So for instance, you could make a dbFormExternalControl that has an entry item, but from a UI perspective is a toolbar button running in checked, or group mode. No custom code to write to deal with updates or anything, just respond to the proper messages and add an Entry_Item and voila, a db(database)-aware toolbar button.

Sample

This sample updates a group of toolbar buttons:

Object oMyToolbarUpdater is a dbFormExternalControl
    Set GUISize to 0 0
    Set GUILocation to 0 0
    Set Focus_Mode to NonFocusable

    Entry_Item Job.Status

    // The class expects a message named Set ControlValue. It is passed a string
    // and should be used to change the value of the windows control. This
    // is the message "C" from above.
    Procedure Set ControlValue string sVal
        If (sVal = "O") begin
            Set pbEnabled of (oActive(oMyToolbar)) to True
            Set pbEnabled of (oCancel(oMyToolbar)) to True
            Set pbChecked of (oActive(oMyToolbar)) to True
            Set pbChecked of (oCancel(oMyToolbar)) to False
        End
        If (sVal = "X") begin
            Set pbEnabled of (oActive(oMyToolbar)) to True
            Set pbEnabled of (oCancel(oMyToolbar)) to True
            Set pbChecked of (oActive(oMyToolbar)) to False
            Set pbChecked of (oCancel(oMyToolbar)) to True
        End
        If (sVal = "C") begin
            Set pbEnabled of (oActive(oMyToolbar)) to False
            Set pbEnabled of (oCancel(oMyToolbar)) to False
            Set pbChecked of (oActive(oMyToolbar)) to False
            Set pbChecked of (oCancel(oMyToolbar)) to False
        End
    End_Procedure

    // The class expects a messsage named get controlValue. It will return
    // the control's data value.
    Function ControlValue Returns String
        String sVal
        Boolean bActive bCancel

        Get pbChecked of (oActive(oMyToolbar)) to bActive
        Get pbChecked of (oCancel(oMyToolbar)) to bCancel

        If (bActive and not(bCancel)) function_return "O"
        If (not(bActive) and bCancel) function_return "X"
        If (not(bActive) and not(bCancel)) function_return "C"
        Else Function_Return "C"
    End_Function

End_Object