You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

&<img src="../resources/images/opentocr.png" title="Open Contents list" border="0"&>
You are here:

Picklist Code You Can Copy

You can copy and paste the following code to any component in which you want to use property sheets containing picklists. The code creates the collection of picklists and picklist items as well as the subroutines for adding picklists and items to the collections.
Put the following definitions in the beginning of your component:

  • Pick list and pick list item definitions for the property sheet
  • pick list counter (index)
    DEFINE_COM class(#STD_COUNT) name(#CUR_PLIST)
  • pick list item counter (index)
    DEFINE_COM class(#STD_COUNT) name(#CUR_PITEM)
  • collection of pick lists (shown inside the property sheet)
    DEFINE_COM class(#PRIM_KCOL) name(#PL_COL) collects(#PRIM_PKLT) keyedby(#STD_COUNT)
  • collection of pick list items
    DEFINE_COM class(#PRIM_KCOL) name(#PI_COL) collects(#PRIM_PKIT) keyedby(#STD_COUNT)
    Put these two subroutines after all the DEFINE_COM statements in your component:
  • Add new picklist
    SUBROUTINE name(ADD_PLIST)
  • give the new pick list an index number
    CHANGE field(#CUR_PLIST) to('#Cur_PList + 1')
    ENDROUTINE
  • Add new picklist item
    SUBROUTINE name(ADD_PITEM) parms((#PROPERTY *RECEIVED) (#VALUE *RECEIVED))
  • give the new pick list item an index number
    CHANGE field(#CUR_PITEM) to('#Cur_PItem + 1')
  • Set the caption and the value of the item plus assign it into the picklist
    SET com(#PI_Col<#Cur_PItem>) caption(#property) default(True) value(#value) parent(#PL_COL<#Cur_PList>)
    ENDROUTINE
    &<img src="../resources/images/opentoc-dark.png" title="Open Contents List" border="0"&>
  • No labels