Code:
{curl 8.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{let people:RecordSet =
{RecordSet
{RecordFields
{RecordField "First", domain = String},
{RecordField "Last", domain = String},
{RecordField "Age", domain = int},
{RecordField "edit", domain = int}
},
{RecordData First = "John", Last = "Smith", Age = 25, edit = 0},
{RecordData First = "Jane", Last = "Smith", Age = 29, edit = 1},
{RecordData First = "Jane", Last = "Jones", Age = -1, edit = 0},
{RecordData First = "Ben", Last = "Abrams", Age = 24, edit = 1},
{RecordData First = "Sam", Last = "Jones", Age = 30, edit = 0},
{RecordData First = "Nigel", Last = "Stevens", Age = 32, edit = 1},
{RecordData First = "Bert", Last = "Stevens", Age = 26, edit = 0},
{RecordData First = "John", Last = "Smith", Age = 25, edit = 0},
{RecordData First = "Jane", Last = "Smith", Age = 29, edit = 1},
{RecordData First = "Jane", Last = "Jones", Age = -1, edit = 0},
{RecordData First = "Ben", Last = "Abrams", Age = 24, edit = 1},
{RecordData First = "Sam", Last = "Jones", Age = 30, edit = 0},
{RecordData First = "Nigel", Last = "Stevens", Age = 32, edit = 1},
{RecordData First = "Bert", Last = "Stevens", Age = 26, edit = 0}
}
}
{let rv:RecordView =
{RecordView
people
}
}
{let rg:RecordGrid =
{RecordGrid
record-source = rv,
automatic-columns? = false,
{RecordGridColumn "First"},
{RecordGridColumn "Last"},
{RecordGridColumn "Age"}
}
}
{value
{VBox
rg,
{CommandButton
label = "Check!!!",
{on Action do
let records:{Array-of Record} = {rv.select}
{for r:Record in records do
{if r["Age"] < 0 then
let checked-index:int = {rv.get-index r}
let rg-ui:RecordGridUI = rg.ui-object asa RecordGridUI
let target-cell:#RecordGridCell =
{rg-ui.get-cell-at-index
checked-index,
2
}
{if-non-null target-cell then
{rg.become-active}
{rg-ui.set-grid-focus target-cell}
{break}
}
}
}
}
}
}
}