RecordGridのフォーカス設定について

【ご質問】
“note-grid-focus-out”メソッドを用いて、セルに入力された値をチェックした際にエラーだった場合、
フォーカスを「エラーのあったセル」に設定したいのですが、どうすればよいのでしょうか。

【回答】
チェック後にafterマクロを使用してbecome-activeメソッドを呼び出すことで実現可能です。

詳細は以下のサンプルをご参照ください。

{curl 6.0,7.0,8.0 applet}
{curl-file-attributes character-encoding = “shift-jis”}

{def grid =
    {RecordGrid
        record-source = {RecordSet
                            {RecordFields
                                {RecordField “id”},
                                {RecordField “value”, domain = String, nullable? = true}
                            },
                            {RecordData id = “001”},
                            {RecordData id = “002”},
                            {RecordData id = “003”},
                            {RecordData id = “004”},
                            {RecordData id = “005”}
                        },
        automatic-columns? = false,
        editable? = true,
        {RecordGridColumn “id”, editable? = false},
        {RecordGridColumn “value”, cell-spec = MaxCharChangeableCell}
    }
}

{define-class public MaxCharChangeableCell {inherits StandardStringCell}

  {constructor public {default …}
    {construct-super}
    set self.background = “white”
    set self.border-color = “gray”
    set self.editable? = true
  }
  {method public {note-grid-focus-out}:void
    ||入力値が1であった場合はcorrect?をfalseにする
    {super.note-grid-focus-out}
    let correct?:bool = {if {self.record.get “value”} == “1” then
                                  false
                              else
                                 true
                              }
    {if not correct? then
        {popup-message “1は入力出来ません”}
        ||フォーカスを元に戻して再入力を促す処理
        {after 0s do {self.become-active}}
     else
        {super.note-grid-focus-out}
    }
  }  
}

{View
    {VBox
        grid
    },
    visibility = “normal”,
    {on WindowClose do
        {exit}
    }
}