Thread Rating:
  • 377 Vote(s) - 2.74 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RecordGrid の縦のスクロールバー
01-20-2014, 10:38 AM,
#4
RE: RecordGrid の縦のスクロールバー
縦スクロールと、横スクロールの両方を取得できるようにしてみました。

Code:
{import * from COM.CURL.SONNTAG.LIB}
{define-class public CustomRecordGrid {inherits RecordGrid}
  {constructor public {default ...}
    {construct-super{splice ...}}
  }

  ||縦スクロールの取得
  {method public {get-vscroll}:#Scrollbar
    {return {self.get-scroll Orientation.vertical}}
  }

  ||横スクロールの取得
  {method public {get-hscroll}:#Scrollbar
    {return {self.get-scroll Orientation.horizontal}}
  }

  ||グリッド内のスクロールの取得
  {method private {get-scroll direction:Orientation}:#Scrollbar
    let scroll:#Scrollbar = null
    {walk-graphics
        self,
        ensure-ui-generated? = true,
        {proc {g:Graphic}:void
            {if {type-of g}.name == "\{DisplayFrame-of Scrollbar\}" then
                {type-switch g
                 case bf:BaseFrame do
                    def (val:Graphic, eof?:bool) =
                        {bf.graphical-children.read-one}
                    {if not eof? then
                        {type-switch val
                         case sb:Scrollbar do
                            {if sb.direction == direction then
                                set scroll = sb
                                {return}
                            }
                        }
                    }
                }
            }
        }
    }
    {return scroll}
  }
}

{def rs =
    {RecordSet
        {RecordFields
            {RecordField "a", nullable? = true},
            {RecordField "b", nullable? = true},
            {RecordField "c", nullable? = true},
            {RecordField "d", nullable? = true},
            {RecordField "e", nullable? = true},
            {RecordField "f", nullable? = true},
            {RecordField "g", nullable? = true},
            {RecordField "h", nullable? = true},
            {RecordField "i", nullable? = true}
        }
    }
}

{def grid =
    {CustomRecordGrid record-source = rs }
}
{for i:int = 0 to 50 do
    def new-r = {rs.new-record}
    {rs.append new-r}
}
{VBox grid,
    {CommandButton
        label = "縦スクロールのリセット",
        {on Action do
            {if-non-null sb = {grid.get-vscroll} then
                {sb.set-scroll-value 0}
            }
        }
    },
    {CommandButton
        label = "横スクロールのリセット",
        {on Action do
            {if-non-null sb = {grid.get-hscroll} then
                {sb.set-scroll-value 0}
            }
        }
    },
    {CommandButton
        label = "両スクロールのリセット",
        {on Action do
            {if-non-null sb = {grid.get-vscroll} then
                {sb.set-scroll-value 0}
            }
            ||なぜか連続で呼ぶと正常に振舞わないのでdispatchする
            {dispatch-events false}
            {if-non-null sb = {grid.get-hscroll} then
                {sb.set-scroll-value 0}
            }
        }
    }
}






Messages In This Thread
RE: RecordGrid の縦のスクロールバー - by umemura - 01-20-2014, 10:38 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  RecordGrid の行の実際の高さの調べ方 kay 2 3,117 03-01-2016, 06:14 PM
Last Post: kay
  RecordGrid でDropdownList を表示 umemura 10 14,859 06-30-2015, 06:52 PM
Last Post: dyoshida
  RecordGrid 列の表示/非表示について Yudai-s 2 4,383 05-19-2015, 06:54 PM
Last Post: Yudai-s
  RecordGrid のセル単位のフォーカス制御方法 kay 2 3,286 03-06-2015, 06:34 PM
Last Post: kay
  RecordGrid のセルのフォーカス可否制御 kay 2 3,579 03-02-2015, 07:56 PM
Last Post: kay
  RecordGrid のパフォーマンスについて umemura 8 12,787 01-06-2014, 02:34 PM
Last Post: umemura
  RecordGrid の NavigationPanel について umemura 2 5,117 08-23-2011, 08:52 AM
Last Post: c-s
  RecordGrid で オートコンプリート umemura 1 4,744 07-29-2011, 10:58 PM
Last Post: umemura
  RecordGrid での右詰め umemura 3 6,012 07-29-2011, 01:32 PM
Last Post: c-s
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('884')