実現したかったことはこんな感じでしょうか?
Code:
{curl 8.0 applet}
{def rg = {RecordGrid}}
{define-proc {set-columns-and-fields
rg:RecordGrid,
first-time?:bool = false
}:void
let fields:{Array-of RecordField} = {new {Array-of RecordField}}
let rgc:{Array-of RecordGridColumn} = {new {Array-of RecordGridColumn}}
{if first-time? then
{rgc.append {RecordGridColumn "row-header"}}
{rgc.append {RecordGridColumn "detail-amount-1"}}
{rgc.append {RecordGridColumn "detail-amount-2"}}
{rgc.append {RecordGridColumn "detail-amount-3"}}
{fields.append {RecordField "row-header", caption = "", domain = String}}
{fields.append {RecordField "detail-amount-1",caption= "初回1"}}
{fields.append {RecordField "detail-amount-2",caption= "初回2"}}
{fields.append {RecordField "detail-amount-3",caption= "初回3"}}
else
{rgc.append {RecordGridColumn "row-header"}}
{rgc.append {RecordGridColumn "detail-amount-1"}}
{rgc.append {RecordGridColumn "detail-amount-2"}}
{rgc.append {RecordGridColumn "detail-amount-3"}}
{rgc.append {RecordGridColumn "detail-amount-4"}}
{fields.append {RecordField "row-header", caption = "", domain = String}}
{fields.append {RecordField "detail-amount-1",caption= "2回目1"}}
{fields.append {RecordField "detail-amount-2",caption= "2回目2"}}
{fields.append {RecordField "detail-amount-3",caption= "2回目3"}}
{fields.append {RecordField "detail-amount-4",caption= "2回目4"}}
}
set rg.columns = rgc
set rg.record-source = {RecordSet {RecordFields {splice fields}}}
}
{value
{VBox
rg,
{CommandButton
label = "1回目",
{on Action do
{set-columns-and-fields
rg,
first-time? = true
}
}
},
{CommandButton
label = "2回目",
{on Action do
{set-columns-and-fields
rg,
first-time? = false
}
}
}
}
}