spiegel-keyman/web/docs/engine/guide/examples/__control-by-control.html
2025-01-27 15:34:39 +07:00

49 lines
No EOL
2 KiB
HTML

<html>
<head>
<script src='https://s.keyman.com/kmw/engine/17.0.331/keymanweb.js'></script>
<script>var kmw = keyman;</script>
<script src='https://s.keyman.com/kmw/engine/17.0.331/kmwuitoggle.js'></script>
<script type='text/javascript' src='js/unified_loader.js'></script>
<script type="text/javascript">
function SetupDocument() {
keyman.init({
root: './', // Note - if drawing the latest version of KeymanWeb from the CDN, this will
// default to the source folder on our servers.
ui: 'toggle',
resources: './'
}).then(function() {
// Load the keyboards of your choice here.
loadKeyboards();
/* Disable KeymanWeb interaction on the 'Email to' TEXT control */
keyman.disableControl(document.f.address);
/* Set the default keyboard for the 'Subject' TEXT control to 'off' (i.e. default browser keyboard) */
/* As KeymanWeb relies on the on-screen keyboard to change languages for touch-based devices, this will
* not work for them and will default to the first language added to KeymanWeb after initialization. */
keyman.setKeyboardForControl(document.f.subject, '', '');
/* Set the default keyboard for the 'Message body' TEXTAREA to the LaoKeys keyboard */
keyman.setKeyboardForControl(document.f.text, 'Keyboard_laokeys', 'lo');
});
}
window.addEventListener( 'load' , SetupDocument );
</script>
</head>
<body>
<h1>Control-by-Control Example</h1>
<form name='f' action='.' method='post'>
<p>Email to <span class='note'>(KeymanWeb not enabled)</span><br /><input type='text' name='address' size="40" placeholder="id = address"/></p>
<p>Subject <span class='note'>(Defaults to 'English' or 'off' unless on a touch-based device)</span><br /><input type='text' name='subject' size="40" placeholder="id = subject"/></p>
<p>Message body <span class='note'>(Defaults to 'LaoKeys')</span><br /><textarea name='text' cols='40' rows='10' placeholder="id = text"></textarea></p>
</form>
<a href="control-by-control">Back to Document</a>
</body>
</html>