Thread Rating:
  • 362 Vote(s) - 2.88 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Record の選択について
11-01-2011, 02:58 PM,
#3
RE: Record の選択について
key-press はちょっと要望の機能とは違いました。
再検索時に、同じレコードが返ってくる場合があって、
検索前の選択状態を復元させたい場合には使えそうですね。


とりあえず、after句を使ったコードも書いてみました。
ただ、イベントの順番とかを考えると、after句を使うのはなるべく抑えたい気も・・・。

Code:
{let rs:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField "id", domain = int},
            {RecordField "First", domain = String},
            {RecordField "Last", domain = String},
            {RecordField "Age", domain = int}
        }
    }
}
{let rg:RecordGrid =
    {RecordGrid
        cells-take-focus? = false,
        select-current-record? = true,
        editable? = false,
        record-source = rs
    }
}
{let cb:CommandButton =
    {CommandButton
        label= "検索",
        {on Action do
            set rg.select-current-record? = false
            {rs.delete-all}
            {rs.append
                {RecordData id = 1, First = "John", Last = "Smith", Age = 25}}
            {rs.append
                {RecordData  id = 2, First = "Jane", Last = "Smith", Age = 29}}
            {rs.append
                {RecordData  id = 3, First = "Jane", Last = "Jones", Age = 28}}
            
            {after 0s do
                set rg.select-current-record? = true
                {rg.select-nothing}
            }
        }
    }
}
{let tf:TextField = {TextField }}
{do
    {rg.add-event-handler
        {on sc:SelectionChanged at rg:RecordGrid do
                {if-non-null r = rg.current-record then
                    set tf.value  =
                        {r.get "First"} asa String
                }
        }
    }
}
{VBox rg, tf, cb}


Messages In This Thread
Record の選択について - by umemura - 10-21-2011, 03:51 PM
RE: Record の選択について - by c-s - 10-24-2011, 02:33 PM
RE: Record の選択について - by umemura - 11-01-2011, 02:58 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  Modify Record benzamil 2 3,310 04-03-2017, 01:58 PM
Last Post: benzamil
Forum Jump:


Users browsing this thread:
1 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('318')