ViewStyle プロパティ

LANSA

ViewStyle プロパティ

ViewStyleはリストやツリーの表示方法を設定します。

ViewStyleプロパティを使って、リスト・ビューまたはツリー・ビューがどのように表示されるかを指定します。 リスト・ビューは次の4種類のスタイルから選択できます:

  • Iconスタイルは、大きいアイコンで項目を表示します。
  • Smalliconスタイルは、小さいアイコン(16 x 16 ピクセル)がリスト項目の前に表示されます。
  • Listスタイルは、全ての項目が別途一列に並べられること以外は、Smalliconスタイルと同じです。
  • Reportスタイルはカラム・ヘッダー付きのリストにリスト項目を表示します。

ツリー・ビューの表示スタイルはLevelledまたはUnLevelledです。

通常のツリー・ビューはLevelledです。

UnLevelledツリーでは、カラム・ヘッダー付きの複数のデータ列が表示されます。(これは事実上ツリーとリスト・ビューが結合されたものです。) Unlevelledツリー・ビューは、LANSAエディターで広く使用されています。(例えばファイル保守のフィールド・ツリー・ビューなど)

次の例は、Unlevelledツリー・ビューがどのようにして作成されるかを示しています。 これを利用するには、フルRDMLX対応のフォームが必要です。

Function Options(*DIRECT) 

Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(471) Clientwidth(473) Height(505) Layoutmanager(#ATLM_1) Left(79) Top(111) Width(481)
Define_Com Class(#PRIM_ATLM) Name(#ATLM_1)
Define_Com Class(#PRIM_TRVW) Name(#TRVW_1) Columnbuttonheight(18) Componentversion(1) Displayposition(1) Fullrowselect(True) Height(471) Left(0) Parent(#COM_OWNER) Tabposition(1) Top(0) Viewstyle(UnLevelled) Width(473)
Define_Com Class(#PRIM_ATLI) Name(#ATLI_1) Attachment(Center) Manage(#TRVW_1) Parent(#ATLM_1)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_1) Caption('Name') Captiontype(Caption) Displayposition(1) Level(1) Parent(#TRVW_1) Source(#STD_NAME) Width(32)
Define_Com Class(#PRIM_TVCL) Name(#TVCL_2) Caption('Description') Captiontype(Caption) Displayposition(2) Level(2) Parent(#TRVW_1) Source(#STD_DESCL) Width(45) Widthtype(Remainder)
Evtroutine Handling(#com_owner.CreateInstance)
Set Com(#com_owner) Caption(*component_desc)
#Com_owner.Load_tree
Endroutine
Mthroutine Name(Load_tree)
#Com_owner.Add_departments
Endroutine
Mthroutine Name(Add_Departments)
Define_Com Class(#prim_tvit) Name(#Department_item) Reference(*dynamic)
Select Fields(#deptment #deptdesc) From_File(deptab)
#com_owner.Add_Entry Column_1(#Deptment) Column_2(#Deptdesc) Tree_Item(#Department_item) Item_Icon(#vi_deptcl)
#Com_Owner.Add_Sections( #deptment #department_item )
Endselect
Endroutine
Mthroutine Name(Add_Sections)
Define_Map For(*Input) Class(#deptment) Name(#Department)
Define_Map For(*Input) Class(#prim_tvit) Name(#Parent_item) Mandatory(*null) Pass(*by_reference)
Define_Com Class(#prim_tvit) Name(#Section_item) Reference(*dynamic)
Select Fields(#section #secdesc) From_File(sectab) With_Key(#department)
#com_owner.Add_Entry Column_1(#section) Column_2(#secdesc) Parent_Item(#parent_item) Tree_Item(#Section_item) Item_Icon(#vi_sectcl)
#com_owner.Add_employees( #Department #section #Section_item )
#trvw_1.currentitem.MarginBottom := 5
Endselect
#section_item.marginbottom := 5
Endroutine
Mthroutine Name(Add_Employees)
Define_Map For(*Input) Class(#deptment) Name(#Employee_Department)
Define_Map For(*Input) Class(#Section) Name(#Employee_Section)
Define_Map For(*Input) Class(#prim_tvit) Name(#Parent_item) Mandatory(*null) Pass(*by_reference)
Select Fields(#Empno #Givename #surname) From_File(pslmst1) With_Key(#Employee_department #Employee_section)
#com_owner.Add_Entry Column_1(#Empno) Column_2(#Givename.trim + ', ' + #Surname.trim) Parent_Item(#parent_item) Item_Icon(#vi_employ)
Endselect
Endroutine
Mthroutine Name(Add_Entry)
Define_Map For(*Input) Class(#std_Name) Name(#column_1)
Define_Map For(*Input) Class(#std_Descl) Name(#column_2)
Define_Map For(*Input) Class(#prim_tvit) Name(#Parent_item) Mandatory(*null) Pass(*by_reference)
Define_Map For(*Input) Class(#prim_icon) Name(#Item_Icon) Mandatory(*null) Pass(*by_reference)
Define_Map For(*output) Class(#prim_tvit) Name(#Tree_item) Mandatory(*null) Pass(*by_reference)
#std_name := #Column_1
#std_Descl := #Column_2
Add_Entry To_List(#trvw_1)
#trvw_1.Currentitem.image <= #item_icon
#trvw_1.Currentitem.parentitem <= #parent_item
#tree_item <= #trvw_1.currentitem
Endroutine
End_Com