イベント

InputManJSのコンボコントロールでは、各種イベントがあります。以下のサンプルではアクションに応じて発生したイベントを確認できます。

InputManJSでは、コントロールへのアクションに応じてさまざまなイベントが発生します。コンボコントロールで発生するイベントは、以下の通りです。 イベント名 説明 CheckedChanged アイテムのチェック状態が変更されたときに発生します。 DropDownClosed ドロップダウンリストが閉じられたときに発生します。 DropDownOpened ドロップダウンリストが開いたときに発生します。 ItemsChanged アイテムのリストが変更されたときに発生します。 SelectedChanged 選択しているアイテムが変更されたときに発生します。 SpinDown スピンダウンボタンがクリックされたときに発生します。 SpinUp スピンアップボタンがクリックされたときに発生します。 TextChanged テキストが変更され、コントロールがフォーカスを失ったときに発生します。 コンボコントロールのドロップダウンウィンドウ(getDropDownWindowメソッドで取得)で発生するイベントは、以下の通りです。 イベント名 説明 onClosing ドロップダウンウィンドウが閉じられる直前に発生します。 onOpening ドロップダウンウィンドウが開かれる直前に発生します。
import '@mescius/inputman/CSS/gc.inputman-js.css'; import { InputMan } from '@mescius/inputman'; import products from './data'; InputMan.appearanceStyle = InputMan.AppearanceStyle.Modern; const gcComboBox = new InputMan.GcComboBox(document.getElementById('gcComboBox'), { items: products }); // イベントハンドラ gcComboBox.addEventListener( InputMan.GcComboBoxEvent.CheckedChanged, () => log('CheckedChanged') ); gcComboBox.addEventListener( InputMan.GcComboBoxEvent.DropDownClosed, () => log('DropDownClosed') ); gcComboBox.addEventListener( InputMan.GcComboBoxEvent.DropDownOpened, () => log('DropDownOpened') ); gcComboBox.addEventListener( InputMan.GcComboBoxEvent.ItemsChanged, () => log('ItemsChanged') ); gcComboBox.addEventListener( InputMan.GcComboBoxEvent.SelectedChanged, () => log('SelectedChanged') ); gcComboBox.addEventListener( InputMan.GcComboBoxEvent.SpinDown, () => log('SpinDown') ); gcComboBox.addEventListener( InputMan.GcComboBoxEvent.SpinUp, () => log('SpinUp') ); gcComboBox.addEventListener( InputMan.GcComboBoxEvent.TextChanged, () => log('TextChanged') ); gcComboBox.getDropDownWindow().onClosing((sender, eArgs) => { log('onClosing'); }); gcComboBox.getDropDownWindow().onOpening((sender, eArgs) => { log('onOpening'); }); // テキストボックスにログを出力 const log = (message) => { var textarea = document.getElementById('log'); textarea.value += message + '\n'; textarea.scrollTop = textarea.scrollHeight; }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>コンボコントロール - イベント</title> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> window.onload = function() { System.import('./src/app'); } </script> </head> <body> <select id="gcComboBox"></select><br><br> イベント<br> <textarea id="log" rows="10" cols="30"></textarea> </body> </html>
module.exports = [ '果汁100%オレンジ', '果汁100%グレープ', '果汁100%レモン', '果汁100%ピーチ', 'コーヒーマイルド', 'コーヒービター' ];
System.config({ transpiler: 'plugin-babel', babelOptions: { es2015: true }, meta: { '*.css': { loader: 'css' } }, paths: { // paths serve as alias 'npm:': 'node_modules/' }, // map tells the System loader where to look for things map: { '@mescius/inputman': 'npm:@mescius/inputman/index.js', '@mescius/inputman/CSS': 'npm:@mescius/inputman/CSS', '@mescius/inputman.richtexteditor': 'npm:@mescius/inputman.richtexteditor/index.js', "@mescius/inputman.richtexteditor/CSS": "npm:@mescius/inputman.richtexteditor/CSS", '@mescius/inputman.richtexteditor/JS/plugins/advlist': 'npm:@mescius/inputman.richtexteditor/JS/plugins/advlist/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/all': 'npm:@mescius/inputman.richtexteditor/JS/plugins/all/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/autosave': 'npm:@mescius/inputman.richtexteditor/JS/plugins/autosave/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/charmap': 'npm:@mescius/inputman.richtexteditor/JS/plugins/charmap/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/directionality': 'npm:@mescius/inputman.richtexteditor/JS/plugins/directionality/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/emoticons': 'npm:@mescius/inputman.richtexteditor/JS/plugins/emoticons/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/fullscreen': 'npm:@mescius/inputman.richtexteditor/JS/plugins/fullscreen/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/htmlcode': 'npm:@mescius/inputman.richtexteditor/JS/plugins/htmlcode/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/image': 'npm:@mescius/inputman.richtexteditor/JS/plugins/image/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/link': 'npm:@mescius/inputman.richtexteditor/JS/plugins/link/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/lists': 'npm:@mescius/inputman.richtexteditor/JS/plugins/lists/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/media': 'npm:@mescius/inputman.richtexteditor/JS/plugins/media/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/pagebreak': 'npm:@mescius/inputman.richtexteditor/JS/plugins/pagebreak/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/preview': 'npm:@mescius/inputman.richtexteditor/JS/plugins/preview/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/save': 'npm:@mescius/inputman.richtexteditor/JS/plugins/save/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/searchreplace': 'npm:@mescius/inputman.richtexteditor/JS/plugins/searchreplace/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/table': 'npm:@mescius/inputman.richtexteditor/JS/plugins/table/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/template': 'npm:@mescius/inputman.richtexteditor/JS/plugins/template/plugin.js', '@mescius/inputman.richtexteditor/JS/plugins/wordcount': 'npm:@mescius/inputman.richtexteditor/JS/plugins/wordcount/plugin.js', '@mescius/inputman.comment': 'npm:@mescius/inputman.comment/index.js', '@mescius/inputman.comment/CSS': 'npm:@mescius/inputman.comment/CSS', '@mescius/wijmo': 'npm:@mescius/wijmo/index.js', '@mescius/wijmo.styles': 'npm:@mescius/wijmo.styles', '@mescius/wijmo.cultures': 'npm:@mescius/wijmo.cultures', '@mescius/wijmo.input': 'npm:@mescius/wijmo.input/index.js', '@mescius/wijmo.grid': 'npm:@mescius/wijmo.grid/index.js', '@mescius/wijmo.nav': 'npm:@mescius/wijmo.nav/index.js', '@mescius/spread-sheets': 'npm:@mescius/spread-sheets/index.js', '@mescius/spread-sheets-resources-ja': 'npm:@mescius/spread-sheets-resources-ja/index.js', '@mescius/spread-sheets/styles': 'npm:@mescius/spread-sheets/styles', 'css': 'npm:systemjs-plugin-css/css.js', 'plugin-babel': 'npm:systemjs-plugin-babel/plugin-babel.js', 'systemjs-babel-build': 'npm:systemjs-plugin-babel/systemjs-babel-browser.js' }, // packages tells the System loader how to load when no filename and/or no extension packages: { src: { defaultExtension: 'js' }, "node_modules": { defaultExtension: 'js' }, } });