FileDropComboClass Overview  

Top  Previous  Next

The FileDropComboClass is a FileDropClass based on a COMBO control rather than a LIST control. Therefore it supports not only the selection of existing list items but also the selection of values not in the list, and optionally the addition of new values to the list. See Control Templates--FileDropCombo for information on the template implementation of the FileDropCombo control.

Future File DropCombo Classes

The current implementation of the FileDropComboClass is a place-holder implementation. In the future the FileDropComboClass, or its replacement, will be derived from the BrowseClass.

FileDropComboClass Concepts

Based on the end user selection, you can assign one or more values from the selected item to one or more target fields. You may display one field (e.g., a description field) but assign another field (e.g., a code field) from the selected list item.

The FileDropClass also supports filters, range limits, colors, icons, sorting, and multiple item selection (marking). See Control Templates--FileDropCombo for information on the template implementation of these features.

FileDropComboClass Relationship to Other Application Builder Classes

The FileDropComboClass is closely integrated with the WindowManager. These objects register their presence with each other, set each other's properties, and call each other's methods as needed to accomplish their respective tasks.

The FileDropComboClass is derived from the FileDropClass, plus it relies on several of the other Application Builder Classes to accomplish its tasks. Therefore, if your program instantiates the FileDropClass, it must also instantiate these other classes. Much of this is automatic when you INCLUDE the FileDropClass header (ABDROPS.INC) in your program's data section. See the Conceptual Example.

FileDropComboClass ABC Template Implementation

The ABC Templates automatically include all the classes and generate all the code necessary to support the functionality specified in your application's FileDropCombo control templates.

The templates derive a class from the FileDropComboClass and instantiate an object for each FileDropComboControl template in the application. The derived class and obect is called FDCB# where # is the FileDropCombo Control template instance number. The templates provide the derived class so you can use the FileDropComboControl template Classes tab to modify the FileDropCombo's behavior on an instance-by-instance basis.

The derived FileDropComboClass is local to the procedure, is specific to a single FileDropCombo and relies on the global ErrorClass object and the file-specific RelationManager and FileManager objects for the displayed lookup file.

FileDropComboClass Source Files

The FileDropComboClass source code is installed by default to the Clarion \LIBSRC folder. The FileDropComboClass source code and their respective components are contained in:

 

ABDROPS.INC

FileDropComboClass declarations

 

ABDROPS.CLW

FileDropComboClass method definitions

FileDropComboClass Conceptual Example

The following example shows a typical sequence of statements to declare, instantiate, initialize, use, and terminate a FileDropComboClass object and related objects.

This example uses the FileDropComboClass object to let the end user select or enter a valid state code for a given client. The state code comes from the state file.

PROGRAM

 

INCLUDE('ABWINDOW.INC')

INCLUDE('ABDROPS.INC')

MAP

END

 

State        FILE,DRIVER('TOPSPEED'),PRE(ST),THREAD

StateCodeKey KEY(ST:STATECODE),NOCASE,OPT

Record        RECORD,PRE()

StateCode      STRING(2)

StateName      STRING(20)

             END

            END

 

Customer FILE,DRIVER('TOPSPEED'),PRE(CUS),CREATE,THREAD

BYNUMBER  KEY(CUS:CUSTNO),NOCASE,OPT,PRIMARY

Record    RECORD,PRE()

CUSTNO     LONG

Name       STRING(30)

State      STRING(2)

         END

        END

 

GlobalErrors  ErrorClass

VCRRequest    LONG(0),THREAD

 

Access:State CLASS(FileManager)

Init          PROCEDURE

            END

 

Relate:State CLASS(RelationManager)

Init          PROCEDURE

            END

 

Access:Customer CLASS(FileManager)

Init             PROCEDURE

               END

 

Relate:Customer CLASS(RelationManager)

Init             PROCEDURE

               END

 

StateQ    QUEUE

ST:STATECODE LIKE(ST:STATECODE)

ViewPosition STRING(512)

         END

StateView VIEW(State)

         END

 

CusWindow WINDOW('Add Customer'),AT(,,157,58),IMM,SYSTEM,GRAY

     PROMPT('Customer:'),AT(5,7),USE(?NamePrompt)

     ENTRY(@s20),AT(61,5,88,11),USE(CUS:NAME)

     PROMPT('State:'),AT(5,22),USE(?StatePrompt)

     LIST,AT(61,20,65,11),USE(CUS:State),FROM(StateQ),|

     FORMAT('8L~STATECODE~@s2@'),DROP(5)

     BUTTON('OK'),AT(60,39),USE(?OK),DEFAULT

     BUTTON('Cancel'),AT(104,39),USE(?Cancel)

    END

 

ThisWindow CLASS(WindowManager)

Init     PROCEDURE(),BYTE,PROC,VIRTUAL

Kill     PROCEDURE(),BYTE,PROC,VIRTUAL

          END

 

StateDrop  CLASS(FileDropClass)

Q           &StateQ

          END

 

 CODE

 ThisWindow.Run()

 

ThisWindow.Init PROCEDURE()

ReturnValue     BYTE,AUTO

 CODE

 GlobalErrors.Init

 Relate:State.Init

 Relate:Customer.Init

 SELF.Request = InsertRecord

 ReturnValue = PARENT.Init()

 IF ReturnValue THEN RETURN ReturnValue.

 SELF.FirstField = ?CUS:NAME

 SELF.VCRRequest &= VCRRequest

 SELF.Errors &= GlobalErrors

 SELF.AddUpdateFile(Access:Customer)

 SELF.AddItem(?Cancel,RequestCancelled)

 SELF.OkControl = ?OK

 Relate:Customer.Open

 Relate:State.Open

 SELF.Primary &= Relate:Customer

 SELF.InsertAction = Insert:Batch

 IF SELF.PrimeUpdate() THEN RETURN Level:Notify.

 OPEN(CusWindow)

 SELF.Opened=True

!initialize the FileDropCombo Class with:

! the combo's USE variable, COMBO control, view POSITION, VIEW, combo's FROM QUEUE,

! primary file RelationManager object, WindowManager object, ErrorClass object,

! add records flag, hot fields flag, case sensitive flag

StateDrop.Init(?CUS:State,StateQ.ViewPosition,|

StateView,StateQ,Relate:State,ThisWindow,GlobalErrors,1,0,0)

 StateDrop.Q &= StateQ

 StateDrop.AddSortOrder()

 StateDrop.AddField(ST:STATECODE,StateDrop.Q.ST:STATECODE)

 StateDrop.AddUpdateField(ST:STATECODE,CUS:State)

 ThisWindow.AddItem(StateDrop)

 SELF.SetAlerts()

 RETURN ReturnValue

 

ThisWindow.Kill PROCEDURE()

ReturnValue          BYTE,AUTO

 CODE

 ReturnValue = PARENT.Kill()

 IF ReturnValue THEN RETURN ReturnValue.

 Relate:Customer.Close

 Relate:State.Close

 Relate:State.Kill

 Relate:Customer.Kill

 GlobalErrors.Kill

 RETURN ReturnValue

 

Access:State.Init PROCEDURE

 CODE

 PARENT.Init(State,GlobalErrors)

 SELF.FileNameValue = 'State'

 SELF.Buffer &= ST:Record

 SELF.LazyOpen = False

 SELF.AddKey(ST:StateCodeKey,'ST:StateCodeKey',0)

 

Access:Customer.Init PROCEDURE

 CODE

 PARENT.Init(Customer,GlobalErrors)

 SELF.FileNameValue = 'Customer'

 SELF.Buffer &= CUS:Record

 SELF.Create = True

 SELF.LazyOpen = False

 SELF.AddKey(CUS:BYNUMBER,'CUS:BYNUMBER',0)

 

Relate:State.Init PROCEDURE

 CODE

 Access:State.Init

 PARENT.Init(Access:State,1)

 

Relate:Customer.Init PROCEDURE

 CODE

 Access:Customer.Init

 PARENT.Init(Access:Customer,1)