Thread Rating:
  • 352 Vote(s) - 2.75 Average
  • 1
  • 2
  • 3
  • 4
  • 5
レコードグリッド値コピーペースト時の検知イベント
04-21-2014, 06:11 PM, (This post was last modified: 04-21-2014, 06:24 PM by dyoshida.)
#5
RE: レコードグリッド値コピーペースト時の検知イベント
e.kouさん
カスタムセルをつくってupdate-dataで入力値をチェックする方法でもできそうですが、
未確定のデータがあるか否かの判定でしたら、最後にRecordSetを確認するというのは
どうでしょうか?

更新の前後の値をチェックして更新されていても同じ値なら除外するようにしてみました。
Code:
{let people-rs:RecordSet =
    {RecordSet
        {RecordFields
            {RecordField "First", domain = String},
            {RecordField "Last", domain = String},
            {RecordField "Age", domain = int}
        },
        {RecordData First = "John", Last = "Smith", Age = 25},
        {RecordData First = "Jane", Last = "Smith", Age = 29},
        {RecordData First = "Jane", Last = "Jones", Age = 28}
    }
}

|| 更新前後で値が変わっているレコードを抽出するためのFilter用プロシージャ
{define-proc {modify-field-val-filter-proc r:Record}:bool
    || ペンディング中の更新があるレコード中のフィールド値をチェック
    {if r.pending-update? then
        {if-non-null rs = r.record-set then
            {for f in rs.fields do
                {if {r.field-pending-update? f.name} then
                    || 更新前と更新後の値が異なっていれば抽出対象
                    def org-val = {r.get f.name, pending? = false}
                    def mod-val = {r.get f.name, pending? = true}
                    {if org-val != mod-val then
                        {return true}
                    }
                }
            }
        }
    }
    || 更新されていない、または更新前後で値が変わっていないレコードは抽出対象外
    {return false}
}

{value
    {VBox
        {RecordGrid
            record-source = people-rs,
            height = 3cm
        },
        {CommandButton
            label = "更新チェック",
            {on Action do
                def ra =
                    {people-rs.select
                        filter =
                            {RecordFilter
                                modify-field-val-filter-proc
                            }
                    }
                {if ra.size > 0 then
                    {popup-message {String ra.size} &"レコード更新されています"}
                }
            }
        }
    }    
}


Messages In This Thread
RE: レコードグリッド値コピーペースト時の検知イベント - by dyoshida - 04-21-2014, 06:11 PM
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('1071')