Thread Rating:
  • 338 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RecordGrid のセル単位のフォーカス制御方法
03-06-2015, 03:05 PM,
#1
RecordGrid のセル単位のフォーカス制御方法
お世話になっております。

RecordGrid で、特定のカラムののフォーカス可否を行単位に制御する場合、
どのようにしたらよいでしょうか?

例えば、下図のようなグリッドで、各行が非表示で持っている eol の値によって
各行の amount 列のフォーカス可否を制御したい、といった内容です。
  product  amount
1    A
2    B
3    C

ものすごく基本的なことかとは思うのですが、中々答えにたどりつけておりません…。
ご教示いただけると幸いです。
03-06-2015, 03:30 PM,
#2
RE: RecordGrid のセル単位のフォーカス制御方法
こんな感じでしょうか…

Code:
{define-class public MyEnterKeyCell {inherits StandardStringCell}
  
  {constructor public {default}
    {construct-super}
  }
  
  {method public {refresh-data}:void
    {super.refresh-data}
    
    {dump self.record["edit"]}
    {if self.record["edit"] == 0 then
        set self.cells-take-focus? = false
    else
        set self.cells-take-focus? = true
    }
  }
  
}


{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 = 28, 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 = 28, 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", cell-spec = MyEnterKeyCell}
    }
}

{value
    {VBox
        rg,
        {CommandButton
            label = "append record",
            {on Action do
                {people.append {RecordData}}
            }
        }
    }
}
03-06-2015, 06:34 PM,
#3
RE: RecordGrid のセル単位のフォーカス制御方法
Cell のクラスを自前で作成するんですね…。
おかげ様で期待通りの動きになりそうです。
ありがとうございました!


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,579 03-02-2015, 07:56 PM
Last Post: kay
  RecordGrid の縦のスクロールバー umemura 3 5,154 01-20-2014, 10:38 AM
Last Post: umemura
  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:
2 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('1211')