Thread Rating:
  • 291 Vote(s) - 2.78 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get-cell-at を少しでも早くするには?
02-28-2014, 04:09 PM,
#1
get-cell-at を少しでも早くするには?

グリッドの処理の中で、セルのインスタンスを取得するのに、RecordGridUI.get-cell-at を利用しているのですが、
セル数が多いと、時間がかかります。(当たり前ですが)

この時間を少しでも早くする方法は何かありますか?
あれば教えてください。

1度取得した後は早いので、おそらく、セルのインスタンスの生成で時間がかかっているのだと思いますが、
そうすると、時間短縮は無理っぽいですかね。

Code:
{def tf-rf-size = {TextField value = "100"}}
{def tf-rec-size = {TextField value = "500"}}
{Table columns = 2,
    "カラム数", tf-rf-size,
    "レコード数", tf-rec-size
}
{let grid:#RecordGrid = null}
{CommandButton
    label = "get-cell-at",
    {on Action do

        ||カラム数×レコード数のグリッドを作成
        {do
            set grid = {RecordGrid
                           width = {make-elastic},
                           height = {make-elastic}
                       }
            def rf-ary = {{Array-of RecordField}}
            {for i:int = 0 to {tf-rf-size.value.to-int} do
                {rf-ary.append
                    {RecordField {String i}, nullable? = true}
                }
            }
            def rfs = {RecordFields {splice rf-ary}}
            def rs = {RecordSet rfs}
            def col-ary = {{Array-of RecordGridColumn}}
            {for i:int = 0 to {tf-rf-size.value.to-int} do
                {col-ary.append
                    {RecordGridColumn {String i}}
                }
            }
            {for i:int = 0 to {tf-rec-size.value.to-int} do
                def new-r = {rs.new-record}
                {rs.append new-r}
            }
            set grid.record-source = rs
            set grid.columns = col-ary
        }

        ||カラム数×レコード数の get-cell-at の実行時間
        {do
            def dt = {DateTime}
            {for r in grid.records do
                {for col in grid.columns do
                    def target-cell = {grid.ui.get-cell-at r, col}
                }
            }
            {popup-message "get-cell-at 完了:" & {dt.elapsed}}
        }
    }
}
{CommandButton
    label = " グリッドを再生成せずに get-cell-at",
    {on Action do

        ||カラム数×レコード数の get-cell-at の実行時間
        {if-non-null grid then
            def dt = {DateTime}
            {for r in grid.records do
                {for col in grid.columns do
                    def target-cell = {grid.ui.get-cell-at r, col}
                }
            }
            {popup-message "get-cell-at 完了:" & {dt.elapsed}}
         else
            {popup-message "まだ RecordGrid がありません"}
        }
    }
}


Messages In This Thread
get-cell-at を少しでも早くするには? - by umemura - 02-28-2014, 04:09 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('1045')