Class: dbParentCombo

Properties  Events  Methods    Index of Classes

Allows the user to select a parent record using a combo control

Hierarchy

cObject
---cUIObject
------DfBaseObject
---------DfBaseWindow
------------DfBaseUIWindow
---------------DfBaseControl
------------------DfBaseList
---------------------DfBaseForm
------------------------DfBaseEntry
---------------------------DfBaseComboBoxEntry
------------------------------ComboEntry
---------------------------------dbBasicComboForm_
------------------------------------dbBasicComboForm
---------------------------------------dbDataComboForm
------------------------------------------dbComboFormDS
---------------------------------------------dbComboFormDD_
------------------------------------------------dbComboForm
---------------------------------------------------dbParentCombo

Library: Windows Application Class Library

Package: DbParentCombo.pkg

Description

When using the parent combo control, the Entry_Item command determines the parent table and column that will be used. The combo fills itself by searching the parent table. It fills itself each time a view is loaded (i.e., paged).

Object oOrderHea_Salesperson_ID is a dbParentCombo
    Entry_Item Salesp.Id
    Set Label to "Sold by:"
    Set Size to 11 90
    Set Location to 49 276
    Set peAnchors to anTopRight
    Set Label_Col_Offset to 2
    Set Label_Justification_Mode to jMode_Right
    Set psEmptyItemDescription to "<none>"
End_Object


The value displayed in the combo will be the value of the Entry_Item binding. This can be customized by augmenting the OnDefineDescription event.

Procedure OnDefineDescription String ByRef sDescription
    Move (trim(Salesp.ID) + " - " * SalesP.Name) to sDescription
End_Procedure

If the file.field in the Entry_Item command has a main index, that index will be used for loading the parent records. The Combo_Index property can be set to use a different ordering. The combo list itself will sort the items. This can be disabled by setting Combo_Sort_State to False. Setting this property to False may work better with numeric data.

This object will work best when Entry_State is False, which is the default.

You usually want an "undefined" item in the list, which is selected when the parent record is cleared or null. This is determined by the pbAddEmptyItem property, which defaults to True. The content of the empty item can be customized by setting the psEmptyItemDescription property.

Parent combos work best with parent tables that are mostly static. The parent list is loaded when the object is paged. If the view is closed and reopened, the data will be reloaded. If new parents are being added with any frequency, you can set pbRefillOnFocus to True. This will instruct the object to refill the list each it takes the focus.

When displaying existing records, the object can detect when an existing parent record is missing from the list and will attempt to bring the list up to date. You can send the manually send the message ComboRefill to reload the parent combo list.

If your list is either too large or too dynamic, you probably want to use some other control.