Thread Rating:
  • 321 Vote(s) - 2.75 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RecordGridの特定のセルにフォーカスを設定したい
03-10-2015, 10:00 AM,
#2
RE: RecordGridの特定のセルにフォーカスを設定したい
RecordGridUI.set-grid-focusメソッドでフォーカスの設定ができます。
チェックを行ったタイミングでどのセルかを取得し、
そのセルを引数にset-grid-focusを呼べばフォーカスが当たります。

(セルの取得の仕方は、RecordGridUI.get-cell-at-index、
RecordGridUI.get-cell-atメソッドを使えばいいと思います。)


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}
                        }
                    }
                }
            }
        }
    }
}


Messages In This Thread
RE: RecordGridの特定のセルにフォーカスを設定したい - by dankom - 03-10-2015, 10:00 AM
Forum Jump:


Users browsing this thread:
3 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('1215')