Versions Compared

Key

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

この例では、リストを定義して単純な値とピックリストの両方でエントリーを追加する方法を示すプロパティ・シートを作成します。

Image Added

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

...

この例では、リストを定義して単純な値とピックリストの両方でエントリーを追加する方法を示すプロパティ・シートを作成します。
Image Removed

プロパティ・シートの例のコード

このコードをコピーしてフォームに貼り付け、フォームをコンパイルして実行してください。  
FUNCTION options


FUNCTION options(*DIRECT)
BEGIN_

...

COM height(254)

...

left(375)

...

top(161)

...

width(272)
DEFINE_

...

COM class(#PRIM_PROP)

...

name(#PROP_1)

...

busyupdatesofparent(True)

...

columnbuttons(False)

...

displayposition(1)

...

dragstyle(Aggregated)

...

height(153)

...

left(16)

...

parent(#COM_OWNER)

...

rowheight(15)

...

tabposition(1)

...

top(16)

...

visualstyleofparent(False)

...

width(233)

...


DEFINE_

...

COM class(#PRIM_PHBN)

...

name(#PHBN_1)

...

caption('

...

Show Properties')

...

displayposition(2)

...

left(16)

...

parent(#COM_OWNER)

...

tabposition(2)

...

top(184)

...

width(105)
DEFINE_

...

COM class(#PRIM_PRCL)

...

name(#PRCL_1)

...

displayposition(1)

...

parent(#PROP_1)

...

source(#PROPERTY)

...

width(50)
DEFINE_

...

COM class(#PRIM_PRCL)

...

name(#PRCL_2)

...

displayposition(2)

...

parent(#PROP_1)

...

source(#VALUE)

...

width(20)

...

widthtype(Remainder)

...


* Data class definitions for the property sheet
* Define #givename data class based on the repository field #givename
DEFINE_COM class(#GIVENAME)

...

name(#GIVENAME)

...


* Define #surname data class based on the elemental data class #PRIM_ALPH (string)
DEFINE_

...

COM class(#SURNAME)

...

name(#SURNAME)

...


* Define #salary data class based on the repository field #salary
DEFINE_

...

COM class(#SALARY)

...

name(#SALARY)

...


* Define #expenses data class based on the elemental data class #PRIM_NMBR (number)
DEFINE_

...

COM class(#PRIM_ALPH)

...

name(#OPTIONSA)

...


* Define #optionsn data class based on the elemental data class #PRIM_NMBR (number)
DEFINE_

...

COM class(#PRIM_NMBR)

...

name(#OPTIONSN)

...

length(9)

...


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

...


* 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

...


* fill the property sheet
EVTROUTINE handling(#prop_1.Initialize)

...

options(*

...

NOCLEARMESSAGES *NOCLEARERRORS)

...


* set values for the entries
CHANGE field(#GIVENAME)

...

to('''Veronica''')

...


SET com(#surname)

...

value('Brown')

...


CHANGE field(#SALARY)

...

to(60000)

...


* Add an alphanumeric entry based on the data class of the field - First Name
CHANGE field(#PROPERTY)

...

to('''

...

First Name''')

...


CHANGE field(#VALUE)

...

to(#GIVENAME)
ADD_

...

ENTRY to_list(#PROP_1)

...


SET com(#prop_1.CurrentItem)

...

dataclass(#givename)

...


* Add an alphanumeric entry based on the data class of the field - Surname
CHANGE field

...

(#PROPERTY)

...

to('''Surname''')

...


CHANGE field(#VALUE)

...

to(#surname)
ADD_

...

ENTRY to_list(#PROP_1)

...


SET com(#prop_1.CurrentItem)

...

dataclass(#surname)

...


* Add a numeric entry based on the data class of the field - Salary
CHANGE field(#PROPERTY)

...

to('''Salary''')

...


CHANGE field(#VALUE)

...

to('#SALARY.TEXT')
ADD_

...

ENTRY to_list(#PROP_1)

...


SET com(#prop_1.CurrentItem)

...

dataclass(#salary)

...


* Create picklist with three items and add it to an alphanumeric entry - Alpha Options
EXECUTE subroutine

...

(ADD_PLIST)

...


EXECUTE subroutine(ADD_PITEM)

...

with_parms('A'

...

'

...

option A')

...


EXECUTE subroutine(ADD_PITEM)

...

with_parms('B'

...

'

...

option B')

...


EXECUTE subroutine(ADD_PITEM)

...

with_parms('C'

...

'

...

option C')

...


CHANGE field(#PROPERTY)

...

to('''

...

Alpha Options''')

...


SET com(#optionsa)

...

picklist(#PL_COL<#Cur_PList>)

...


CHANGE field(#VALUE)

...

to('#OPTIONSA.TEXT')
ADD_

...

ENTRY to_list(#PROP_1)

...


SET com(#prop_1.CurrentItem)

...

dataclass(#optionsa)

...


* Create picklist with three items and add it to a numeric entry - Numeric Options
EXECUTE subroutine(ADD_PLIST)

...


EXECUTE subroutine(ADD_PITEM)

...

with_parms('1001'

...

'1001')

...


EXECUTE subroutine(ADD_PITEM)

...

with_parms('220'

...

'220')

...


EXECUTE subroutine(ADD_PITEM)

...

with_parms('34'

...

'34')

...


CHANGE field(#PROPERTY)

...

to('''

...

Numeric Options''')

...


SET com(#optionsn)

...

picklist(#PL_COL<#Cur_PList>)

...


CHANGE field(#VALUE)

...

to('#OPTIONSN.TEXT')
ADD_

...

ENTRY to_list(#PROP_1)

...


SET com(#prop_1.CurrentItem)

...

dataclass(#optionsn)

...


ENDROUTINE
EVTROUTINE handling(#PHBN_1.Click)

...


USE builtin(MESSAGE_BOX_ADD)

...

with_args('

...

First name: '

...

#GIVENAME)

...


USE builtin(MESSAGE_BOX_ADD)

...

with_args('Surname: '

...

#SURNAME)

...


USE builtin(MESSAGE_BOX_ADD)

...

with_args('Salary:  '

...

#SALARY)

...


USE builtin(MESSAGE_BOX_ADD)

...

with_args('

...

Alpha Options: '

...

#OPTIONSA.TEXT)

...


USE builtin(MESSAGE_BOX_ADD)

...

with_args('

...

Numeric Options:  '

...

#OPTIONSN.TEXT)

...


USE builtin(MESSAGE_BOX_SHOW)

...

with_args(' ' ' ' ' ' '

...

Returned Values')

...


ENDROUTINE
END_COM
 

プロパティ・シートに関する注意事項

値の割り当て

#Value列の値を設定する場合に、エントリーのデータ・クラスが#PRIM_ALPH、#PRIM_NMBR、または数値フィールドに基づく場合は、コンポーネントのTextプロパティを使用する必要があります。

CHANGE field(#PROPERTY) to('''Salary''')
CHANGE field(#VALUE) to('#SALARY.TEXT')
ADD_ENTRY to_list(#PROP_1)
SET com(#prop_1.CurrentItem) dataclass(#salary)

値を返す

プロパティ・シートから値を返す場合は、#PRIM_ALPHまたは#PRIM_NMBRに基づくデータ・クラスのValueプロパティまたはTextプロパティを使用する必要があります。

USE builtin(MESSAGE_BOX_ADD) with_args('First name: ' #GIVENAME)
USE builtin(MESSAGE_BOX_ADD) with_args('Last name: ' #SURNAME)
USE builtin(MESSAGE_BOX_ADD) with_args('Salary:  ' #SALARY)
USE builtin(MESSAGE_BOX_ADD) with_args('Alpha Options: ' #OPTIONSA.TEXT)
USE builtin(MESSAGE_BOX_ADD) with_args('Numeric Options:  ' #OPTIONSN.TEXT)

...