Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

[ Image Removed |../../index.htm#lansa/l4wdev06_1145.htm]
現在地:

...

以下のコードをピックリストを持つプロパティ・シートを使用するコンポーネントにコピーして貼り付けることができます。コードは、ピックリストとピックリスト・アイテムのコレクション、コレクションにピックリストとアイテムを追加するサブルーチンを作成します。

コンポーネントの先頭に以下の定義を置きます。  
* Pick list and pick list item definitions for the property sheet
* pick list counter (index) DEFINE_COM class

     * 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)

 
コンポーネントのすべてのDEFINE_COMステートメントの後に以下の2つのサブルーチンを置きます。  
* Add new picklist SUBROUTINE name

     * 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