抜け道がありそうですが・・・。
Code:
||先頭でポジションを保持するカラム
{define-class public CustomRecordGridColumn {inherits RecordGridColumn}
field public position-fix?:bool
{constructor public {default
position-fix?:bool = false,
...
}
set self.position-fix? = position-fix?
{construct-super {splice ...}}
}
}
||CustomRecordGridColumn に位置を保持させるグリッド
{define-class public CustomRecordGrid {inherits RecordGrid}
{constructor public {default
...
}
{construct-super {splice ...}}
}
{method public {move-column
source-index:int,
destination-index:int
}:void
||移動先のカラムが CustomRecordGridColumn.position-fix?=true なら
||カラムの移動自体をキャンセルする
{if destination-index < self.columns.size - 1 then
{type-switch self.columns[destination-index]
case crgc:CustomRecordGridColumn do
{if crgc.position-fix? then {return }}
}
}
{super.move-column source-index, destination-index}
}
}
{let rec_set:RecordSet=
{RecordSet
{RecordFields
{RecordField "id" ,domain = int,caption="ID"}
,{RecordField "name" ,domain = String,caption="名前"}
,{RecordField "age" ,domain = String,caption="年齢"}
,{RecordField "sex" ,domain = String,caption="性別"}
}
,{RecordData id=1,name="一郎",age="20才",sex="男"}
,{RecordData id=2,name="花子",age="18才",sex="女"}
,{RecordData id=3,name="次郎",age="16才",sex="男"}
,{RecordData id=4,name="良子",age="14才",sex="女"}
,{RecordData id=5,name="三郎",age="12才",sex="男"}
}
}
{let RG:CustomRecordGrid=
{CustomRecordGrid
record-source=rec_set,
{CustomRecordGridColumn
"id",
column-movable? = false,
column-resizable? = false
,position-fix? = true
}
}
}
{RG.set-frozen-region 0,1}
{value RG}