Thread Rating:
  • 282 Vote(s) - 2.63 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RecordGridのセルでEnterキーを押下したときにフォーカス移動
03-06-2015, 10:17 AM,
#2
RE: RecordGridのセルでEnterキーを押下したときにフォーカス移動
こんなんでどうでしょうか。

Code:
{define-class public EnterKeyCell {inherits StandardStringCell}
  
  {constructor public {default}
    {construct-super}
  }
  
  {method public {create-editor}:TextField
    let editor:TextField = {super.create-editor}
    {editor.ui-object.add-event-handler
        {on e:KeyPress do
            {if e.value == KeyPressValue.enter then
                def shift? = e.shift?
                {after 0s do
                    {self.grid.ui.traverse forward? = not shift?}
                }
                {e.consume}
            }
        }
    }
    {return editor}
  }
}

{let people: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},
        {RecordData First = "Ben", Last = "Abrams", Age = 24},
        {RecordData First = "Sam", Last = "Jones", Age = 30},
        {RecordData First = "Nigel", Last = "Stevens", Age = 32},
        {RecordData First = "Bert", Last = "Stevens", Age = 26}
    }
}

{let rv:RecordView =
    {RecordView
        people
    }
}

{let rg:RecordGrid =
    {RecordGrid
        record-source = rv,
        cell-spec = EnterKeyCell,

        {RecordGridColumn "First"}
    }
}

{value
    {VBox
        rg,
        {CommandButton
            label = "append record",
            {on Action do
                {people.append {RecordData}}
            }
        }
    }
}


Messages In This Thread
RE: RecordGridのセルでEnterキーを押下したときにフォーカス移動 - by dankom - 03-06-2015, 10:17 AM
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('1210')