Incari Studio
2023.1
2023.1
  • Incari HMI Development Platform
  • Getting Started
    • Overview
    • Requirements
    • What's New
    • Installation
    • First Steps
      • Incari Hub
      • Creating a Project
      • Incari Studio
  • Objects and Types
    • Overview
    • Project Objects
      • Scene
      • Scene2D
      • Screen
      • HMD
    • Scene Objects
      • Audio
      • Camera
      • Group
      • Image Sequence Sprite
      • Label
      • Light
      • List
      • Lottie Sprite
      • Mesh
      • On-Screen Keyboard
      • Overlay
      • Primitives
      • Sprite
      • Text
      • Vector
      • Video
      • Web Sprite
    • Scene2D Objects
      • Camera
      • Frame
      • GUI
        • Button
        • Dropdown
        • List
        • Slider
        • Text
        • Text Area
        • Text Input
        • Toggle
      • Image
      • Vector
    • Prefabs
      • Creating and Using Prefabs
        • Prefabs in Scenes
        • Prefabs in Scene2Ds
      • Logic in Prefabs
      • Nested Prefabs
    • Attributes
      • Attribute Types
        • Asset/Object Attribute
        • Boolean Attribute
        • Color Attribute
        • Numerical Attribute
      • Common Attributes
        • Object
        • Sprite
        • Transformation
          • Global Transformations
          • Local Transformations
        • Tag
    • Data Types
      • Bool
      • Byte
      • Float
      • Int
      • String
      • Vector2
      • Vector3
      • Vector4
    • Terminology
  • Modules
    • Overview
    • Animation Editor
    • Asset Database
    • Asset Manager
    • Attribute Editor
    • Code Editor
    • Console
    • Exporter
    • Image Sequence Editor
    • Logic Editor
    • Global Preferences
    • Material Editor
      • Car Paint Model
      • Custom Shading Model
      • Phong Model
      • Glass Model
      • Extended PBR Model
      • PBR Model
      • Shadeless Model
    • Model Editor
    • Plugins
      • Communication
        • MAVLink
        • Serial
        • Socket.IO
        • TCP
        • UDP
    • Profiler View
    • Project Outliner
    • Project Settings
      • CAN
      • Fonts
      • HTTP
      • Keyboard
      • MAVLink
      • MQTT
      • Profiler
      • Scene Separation
      • Serial
      • Socket.IO
      • Styles
      • TCP
      • UDP
    • Scene Outliner
  • Toolbox
    • Overview
    • Actions
      • Delay Action
      • FadeFromTo Action
      • FadeTo Action
      • MoveBy Action
      • MoveTo Action
      • RotateBy Action
      • RotateTo Action
      • RotateFromTo Action
      • ScaleBy Action
      • ScaleTo Action
    • Array
      • Array Value
      • Clear Array
      • Concat Arrays
      • Get Array Element
      • Insert Array Element
      • Length of Array
      • Pop Array Element
      • Push Array Element
      • Remove Array Element
      • Set Array Element
    • Binary
      • Binary (Hex) Value
      • Concat Binaries
    • Communication
      • CAN
        • CAN Send Packet
        • CAN Start
        • CAN Stop
        • Events
          • On CAN Packet Received
          • On CAN Start
          • On CAN Stop
      • HTTP
        • Events
          • On HTTP Route
          • On HTTP Server Start
          • On HTTP Server Stop
        • HTTP Client
        • HTTP Response
        • HTTP Server Start
        • HTTP Server Stop
      • MAVLink
        • Events
          • On MAVLink Packet Received
          • On MAVLink Start
          • On MAVLink Stop
        • MAVLink Decode
        • MAVLink Start
        • MAVLink Stop
      • MQTT
        • Events
          • On MQTT Start
          • On MQTT Stop
          • On MQTT Topic
        • MQTT Publish
        • MQTT Start
        • MQTT Stop
        • MQTT Subscribe
      • Serial
        • Events
          • On Serial Error
          • On Serial Packet Receive
          • On Serial Start
          • On Serial Stop
        • Serial Send Packet
        • Serial Start
        • Serial Stop
      • Socket.IO
        • Events
          • On Socket.IO Error
          • On Socket.IO Receive
          • On Socket.IO Start
          • On Socket.IO Stop
        • Socket.IO Send
        • Socket.IO Start
        • Socket.IO Stop
        • Socket.IO Subscribe
        • Socket.IO Unsubscribe
      • TCP
        • Events
          • On TCP Error
          • On TCP Packet Receive
          • On TCP Start
          • On TCP Stop
        • TCP Send
        • TCP Start
        • TCP Stop
      • UDP
        • Events
          • On UDP Error
          • On UDP Packet Receive
          • On UDP Start
          • On UDP Stop
        • UDP Send
        • UDP Start
        • UDP Stop
    • DateTime
      • Date Time Formatter
      • Now (UTC)
      • System Time
      • Timezone Value
    • Development
      • Assert
      • Benchmark Get
      • Benchmark Start
      • Benchmark Stop
      • Clear Console
      • Console
      • Profiler Start
      • Profiler Stop
    • Dictionary
      • Clear Dictionary
      • Dictionary Value
      • Erase Dictionary Element
      • Get Dictionary Element
      • Get Dictionary Keys
      • Get Dictionary Values
      • Merge Dictionaries
      • Set Dictionary Element
      • Size of Dictionary
    • Events
      • Custom
        • Event Listener
        • Event Trigger
      • Gestures
        • On Swipe
        • On Tap
      • ImageSequence
        • On ImageSequence Frame Changed
        • On ImageSequence Pause
        • On ImageSequence Play
        • On ImageSequence Stop
      • Input
        • On Text Change
      • Keyboard
        • On Key Press
        • On Key Release
      • Leap Motion
        • On Leap Motion Frame Update
        • On Leap Motion Grab End
        • On Leap Motion Grab Start
        • On Leap Motion Grab Update
        • On Leap Motion Pinch End
        • On Leap Motion Pinch Start
        • On Leap Motion Pinch Update
        • On Leap Motion Swipe Left
        • On Leap Motion Swipe Right
        • XR Position
      • List
        • On List Current Index Change
        • On List Entry Select
        • On List Load
      • List 2D
        • On List Active Index Change
      • Lottie
        • On Lottie Finish
        • On Lottie Pause
        • On Lottie Play
        • On Lottie Stop
      • Media
        • On Media Finish
        • On Media Play
      • Mouse
        • Get Mouse Position
        • Get Mouse Position Delta
        • On Hover Enter
        • On Hover Leave
        • On Mouse Button Down
        • On Mouse Button Up
        • On Mouse Click
        • On Mouse Double Click
        • On Mouse Enter
        • On Mouse Leave
        • On Mouse Move
        • On Mouse Scroll
      • Object
        • On Alpha Change
        • On CheckBox Value Change
        • On Dropdown Active Value Change
        • On Opacity Change
        • On Position Change
        • On Rotation Change
        • On Scale Change
        • On Slider Value Change
        • On Visibility Change
      • On-Screen Keyboard
        • On On-Screen Keyboard Arrow Down Pressed
        • On On-Screen Keyboard Arrow Up Pressed
        • On On-Screen Keyboard Enter Pressed
        • On On-Screen Keyboard Input Changed
        • On On-Screen Keyboard Key Pressed
      • Unsubscribe
      • Screen
        • On Screen Scene Change
      • Variables
        • On Variable Change
        • On Variable Set
      • Web
        • On JavaScript Callback
      • WebSprite
        • On WebSprite Load
        • On WebSprite Remote URL Change
    • Flow Control
      • Branch
      • For Each Loop
      • For Loop
      • Index Switch
      • Is Equal
      • Is Greater Equal
      • Is Less Equal
      • Select Data
      • Sequential
      • Switch
      • Toggle
    • Functions
      • Function
        • Function Input
        • Function Output
    • IO
      • Create File
      • Get Current Directory
      • Get File Extension
      • List Directory Content
      • Load File
      • Remove
      • Save File
      • Set Current Directory
    • Incari
      • Animation
        • Pause Animation
        • Play Animation
        • Stop Animation
      • Asset
        • Add to Asset Database
        • Remove from Asset Database
      • Camera
        • Get Active Camera
        • Get All Cameras
        • Set Active Camera
      • ImageSequence
        • Get Current ImageSequence Frame
        • Get ImageSequence Duration
        • Get ImageSequence FPS
        • Get ImageSequence Total Frames
        • Go To Next ImageSequence Frame
        • Go To Previous ImageSequence Frame
        • Pause ImageSequence
        • Play ImageSequence
        • Resume ImageSequence
        • Show ImageSequence Frame
        • Stop ImageSequence
      • List
        • Generate List
        • Get Selected Item
        • Next List Entry
        • Previous List Entry
        • Select List Entry
        • Set Active
        • Set Current Index
      • List 2D
        • Add List Element
        • Get Active Index
        • Get List Data
        • Get List Element
        • Insert List Element
        • Remove List Element
        • Set Active Index
        • Set List Data
        • Set List Element
      • Lottie
        • Pause Lottie
        • Play Lottie
        • Stop Lottie
      • Material
        • Set Custom Uniform
      • Media
        • Get Volume
        • Is Media Playing
        • Pause Media
        • Play Media
        • Seek Media
        • Set Volume
        • Stop Media
      • Object
        • Add Tag
        • Destroy Object
        • Get Active Dropdown Value
        • Get Alpha
        • Get CSS Property
        • Get CheckBox Value
        • Get Children
        • Get Dropdown Options
        • Get Material
        • Get Name
        • Get Objects By Tag
        • Get Opacity
        • Get Parent
        • Get Position
        • Get Root
        • Get Rotation
        • Get Scale
        • Get Size
        • Get Slider Value
        • Get Sort Index
        • Get Tag
        • Get Text
        • Get Text Color
        • Get Tint
        • Get Visibility
        • Has Children
        • Instantiate Object
        • On List Item Clicked
        • Remove Tag
        • Set Active Dropdown Index
        • Set Active Dropdown Value
        • Set Alpha
        • Set CSS Property
        • Set CheckBox Value
        • Set Dropdown Options
        • Set Mask
        • Set Material
        • Set Opacity
        • Set Position
        • Set Rotation
        • Set Scale
        • Set Size
        • Set Slider Value
        • Set Sort Index
        • Set Stylesheet
        • Set Text
        • Set Text Color
        • Set Texture
        • Set Tint
        • Set Visibility
        • Use Mask
      • Object 2D
        • Add CSS Class Name
        • Get CSS Class Names
        • Remove CSS Class Name
        • Set CSS Class Names
      • On-Screen Keyboard
        • Get Screen Keyboard Layout
        • On-Screen Keyboard Clear Input
        • On-Screen Keyboard Get Input
        • On-Screen Keyboard Move Selection
        • On-Screen Keyboard Press Button
        • Set Screen Keyboard Layout
      • Scene 2D
        • Get Stylesheet
        • Merge To Stylesheet
        • Set Stylesheet
      • This Scene
      • Ultrahaptics
        • Ultrahaptics Play
        • Ultrahaptics Stop
      • Scenes
        • Scene
      • Screen
        • Get Scene
        • Set Scene
      • Screens
        • Screen
      • Vector
        • Arc
          • Get ArcEnd
          • Get ArcStart
          • Set ArcEnd
          • Set ArcStart
        • Get BackgroundColor
        • Get FillColor
        • Get StrokeWidth
        • Label
          • Get LabelText
        • Line
          • Get LineWidth
          • Set LineWidth
        • Pie
          • Get PieEnd
          • Get PieStart
          • Set PieEnd
          • Set PieStart
        • Rectangle
          • Get RectangleCorners
          • Set RectangleCorners
        • Set BackgroundColor
        • Set FillColor
        • Set StrokeWidth
      • WebSprite
        • Get Remote URL
        • Set Remote URL
        • Web Sprite Reload
    • Math
      • Absolute
      • Add
      • Average
      • Boolean
        • AND
        • Bool Value
        • Negate
        • OR
      • Ceil
      • Clamp
      • Decrement
      • Divide
      • Floor
      • Increment
      • Interpolate
      • Logarithm
      • Math Constant
      • Maximum
      • Minimum
      • Modulo
      • Multiply
      • Numerical Value
      • Power
      • Random
      • Range Mapper
      • Root
      • Rotation Matrix
      • Round
      • Subtract
      • Trigonometry
        • Arc Cosine
        • Arc Sine
        • Arc Tangent
        • Arc Tangent 2
        • Cosine
        • Radian-Degree Converter
        • Sine
        • Tangent
      • Vector Value
    • Plugins
      • (JSON) Scale Vector
    • Prefab
      • This Prefab
    • String
      • Capitalize
      • CharCodeAt
      • Compare
      • Concat Strings
      • Contains
      • CryptoHash
      • EndsWith
      • Format
      • FormatArray
      • IndexOf
      • IsLower
      • IsUpper
      • JSON Parse
      • JSON Stringify
      • Join
      • LastIndexOf
      • Length
      • Lower
      • MatchRegex
      • PaddingLeft
      • PaddingRight
      • RandomString
      • RemoveCharacters
      • Replace
      • ReplaceRegex
      • Reverse
      • Split
      • StartsWith
      • String Value
      • Substring
      • Trim
      • TrimLeft
      • TrimRight
      • Upper
    • Transition
      • CrossFade
      • Fade
      • MoveInFromBottom
      • MoveInFromLeft
      • MoveInFromRight
      • MoveInFromTop
      • SlideInFromBottom
      • SlideInFromLeft
      • SlideInFromRight
      • SlideInFromTop
    • Utilities
      • Color Value
      • Conversion
      • Create CustomID
      • Create Object
      • Get Command Line Option
      • Group
      • Interval
        • Reset Interval
        • Start Interval
      • Is Data Type
      • Is Object Type
      • System Call
      • Timeout
        • Cancel Timeout
        • Start Timeout
    • Variables
      • Variable Getter
      • Variable Setter
    • Web
      • Call JavaScript Function
  • Demo Projects
    • Overview
    • 4 Methods of Animation
    • Using APIs to Pull Dynamic Data
    • An Analog Clock
    • Image Sequence Button Animation
    • Prefabs
    • Project Initialization
    • On-Screen Keyboard
Powered by GitBook
On this page
  • Overview
  • 1. Using the On-Screen Keyboard
  • 2. Utilizing Custom Layouts
  • 1) Creating Custom Keys
  • 2) Creating Custom Sub-Layouts
  • 3. Styling the Keyboard
  • 4. Adding Logic to Our Keyboard
  • 1) Initialization
  • 2) Field Selection
  • 3) Form Submission
  • 4) Data Manipulation

Was this helpful?

  1. Demo Projects

On-Screen Keyboard

PreviousProject Initialization

Last updated 1 year ago

Was this helpful?

Overview

In most applications that require user input, keyboards are a necessary component vital to the user. That is why, as a comprehensive HMI creation solution, Incari Studio comes pre-equipped with an .

However, thanks to the advanced customization options in Incari Studio, it is now possible for one to configure their own keyboard. This takes things a step further and provides the opportunity for more personal and unique designs.

This Demo Project aims to instruct on the following:

  1. Providing more information on the On-Screen Keyboard in Incari.

  2. Learning to modify a stock On-Screen Keyboard using the new Layout Attribute.

  3. Clarifying how to alter its Style Attribute using Cascading Style Sheets (CSS).

Before you start

This Demo Project can be downloaded in the

1. Using the On-Screen Keyboard

Simply start by creating a new On-Screen Keyboard Object by following Create > On-Screen Keyboard in the Scene Outliner.

Click on this new Object and go to the Attribute Editor. Here one can see the Object's general Attributes as well as those which enable one to modify the Layout, Style, and Text properties of the On-Screen Keyboard.

To start with, set the size under Size to x = 1366, y = 580 and z = 1. Also, for now, the Layout Attribute can be set to English.

2. Utilizing Custom Layouts

Incari Studio now supports custom layouts for On-Screen Keyboard Objects. First, create a Keyboard Layout Asset file called english_custom to utilize throughout the course of this project.

After creating the layout, a double-click will open up the Code Editor with the default layout. Incari Studio already handles the switch between default, alt, and shift layouts. So, if only a small change is required, one can utilize these predefined layouts.

To use these layouts with the On-Screen Keyboard Object that has just been created, they must be added to the Project in Project Settings under Keyboard > Layout Manager. After this step, simply select the newly added layout from the Layout > Layout Family selector under Attribute Editor.

1) Creating Custom Keys

To add Custom keys to your keyboard or change the way that stock buttons like alt, backspace, or capslock are rendered, you can simply do so by adding a definition under the display dictionary within the Code Editor.

For instance, in order to have the Caps Lock key rendered as caps,one would need to input the following code:

"display": {
  ...
  "{lock}": "caps",
  ...
}

Of course, this feature can be used to avoid duplicating hard-to-use symbols or codepoints throughout the layout. For instance, to use the symbol ⇪ for the Caps Lock key, you could simply add {lock} to your layouts and define it with a codepoint under the display dictionary as follows:

"{lock}": "&#xF223"

2) Creating Custom Sub-Layouts

Using the custom_layouts dictionary, one can add new sub-layouts and switch to them using custom keys. For any sub-layout “X”, adding a key named “showX” initiates the switch to the new sub-layout. Of course, this key can be rendered in any way seen fit by the designer.

For example, one might want to add a key to the default sub-layout that would make it switch to a German QWERTZ keyboard. This German keyboard would, in turn, have a key to show the abbreviation for the current English layout. Our code would look like this:

{   
    "default": [
        "[q w e r t y u i o p]",
        "[a s d f g h j k l]",
        "{shift} [z x c v b n m] {bksp}",
        "{showgerman} {voice} {space} {hide} {enter}"
    ],
    
    "shift": [
        "[Q W E R T Y U I O P]",
        "[A S D F G H J K L]",
        "{shift} [Z X C V B N M] {bksp}",
        "{showgerman} {voice} {space} {hide} {enter}"
    ],

    "display": {
    "{enter}": "return",
    "{bksp}": "delete",
    "{default}": "DE",
    "{showgerman}": "EN",
    "{voice}": "voice",
    "{shift}": "shift",
    "{showgerman_shift}": "shift",
    "{showgerman_fromshift}": "shift",
    "{hide}": "hide"
    },

    "custom_layouts": {

      "german": [
        "[q w e r t z u i o p ü]",
        "[a s d f g h j k l ö ä]",
        "{showgerman_shift} [y x c v b n m ß {bksp}",
        "{default} {voice} {space} {hide} {enter}"
      ],
      "german_fromshift": [
        "[q w e r t z u i o p ü]",
        "[a s d f g h j k l ö ä]",
        "{showgerman_shift} [y x c v b n m ß] {bksp}",
        "{default} {voice} {space} {hide} {enter}"
      ],
      "german_shift": [
        "[Q W E R T Z U I O P Ü]",
        "[A S D F G H J K L Ö Ä]",
        "{showgerman_fromshift} [Y X C V B N M ß] {bksp}",
        "{default} {voice} {space} {hide} {enter}"
      ]
    }
}

3. Styling the Keyboard

As the last step in making the On-Screen Keyboard a unique design, Incari Studio enables the user to use CSS files to customize the look and feel. To start, simply create a CSS file in the Asset Manager and drag it to the Style Attribute of the On-Screen Keyboard Object in the Attribute Editor.

  • .simple-keyboard: Keyboard container.

  • .hg-row: Keyboard rows.

  • .hg-button-container: Groups the buttons between the brackets.

  • .hg-button: Keyboard buttons.

  • .hg-standardBtn: Non-function buttons (e.g. letters, numbers).

  • .hg-functionBtn: Function buttons, wrapped in curly braces in layouts.

  • .hg-button-X: The custom class for a button represented as {X} within the layout file.

For all these classes, standard CSS state selectors are applicable. So, after adding a few simple classes we can create ourselves a good-looking custom keyboard! Here’s a sample style:

.simple-keyboard{
    background: black !important;
}

input{
    background: black !important;
    color: white !important;
    height: 75px;
    font-size: 36px
}

.hg-row{
    height: 120px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
}

.hg-button-container{
    width: 100%;
    display: flex;
    justify-content: center;
}

.hg-button{
    height: 100% !important;
    background: #161616BB !important;
}

.hg-button:hover{
    background: #303030 !important;
}

.hg-button:active{
    transform: scale(0.99);
}

.hg-button>span{
    color: white;
    font-size: 25px
}

.hg-standardBtn {
    width: 100%;
    max-width: 130px;
}

.hg-functionBtn{
    width: 300px;
}

.hg-button-space{
    max-width: 800px;
    min-width: 800px;
    width: 800px !important;
}

4. Adding Logic to Our Keyboard

After having created a styled On-Screen Keyboard with its custom layout settings, it can now be used to dynamically alter the content on our screen. To demonstrate, one can start with a simple form. First, to make room for the extra content that will be added, resize our Screen in Project Outliner by changing the attribute Size to x= 1366, y=720 from within the Attribute Editor.

Then, add the file background.png from the Asset Manager. After that, set the Sort Index for the On-Screen Keyboard to 1, and the Position attribute to x=0, y=-105, z=1.

In order to get rid of the input field that is no longer needed, update the type input of the CSS file as follows:

input{
  display: none
}

Next, add button.png from the Assets and set its Position Attribute to x=495, y=276, z=1. Finally, to finish up on the front-end, add three Label elements from the Scene Outliner using Label with the following Attributes:

  1. Size: x=400, y=42, z=1, Position: x=-430, y=275, z=2,

  2. Size: x=400, y=42, z=1, Position: x=60, y=275, z=2,

  3. Size: x=500, y=42, z=1, Position: x=170, y=194, z=2.

Additionally, for all three of them, Sort Index should be set to 2, Font Color to #FFFFFFFF, and Font size (px) to 36.

Also, in order to register the clicks to their respective text fields, it is necessary to add two touch surfaces. This can be done by grouping Vector elements with each of the previously created Labels and setting their properties as:

  1. Size: x=460, y=60, z=1, Position: x=-415, y=275, z=3, Opacity=0.0, Sort Index=3

  2. Size: x=460, y=60, z=1, Position: x=75, y=275, z=3, Opacity=0.0, Sort Index=3

The end result should look like this:

We can now start adding Logic! The Logic for this Project will be composed of three parts:

  1. Initialization

  2. Field Selection

  3. Form Submission

  4. Data Manipulation

Logic Tip

It is always a good idea to divide Logic into smaller chunks using Groups. To toggle them, simply select a few Nodes and click Ctrl + G. To quickly understand the function of a Group, you can also assign specific colors to specific functions like initialization, value setters, and so on.

1) Initialization

In Incari Studio, the recommended way for working with async events is to use custom Events as they make for a neater Logic that is easier to debug. Start by setting the trigger for Scene Show and put the Object ID values for the Text Objects into a Dictionary Object for easier access later on.

2) Field Selection

In this stage, in order to know which Text Object to edit, there needs to be a way of knowing the field selected. By using a Variable called selected_field, it is possible to keep track of this. Also, to have a way of knowing the value of the fields at any time, simply create another Dictionary called field_values.

3) Form Submission

In order to know when the form is submitted, use another custom Event called data_submit that will eventually trigger the fourth stage of this guide. Triggering this will come from listening to either a mouse click or a press on the Enter key.

4) Data Manipulation

Finally, to reflect the gathered data on our screens, we are concatenating our two strings and setting the corresponding value to our Text Object called Full-name. Also, to get the form ready for next use, we are resetting the values of the Name and Surname Text Objects.

In Summary

Using an On-Screen Keyboard Object, you created a custom input method quickly using Incari Studio! As the user's needs change, layouts can be added or removed while also adapting the Logic to fit each unique situation.

To make styling as easy as possible, Incari Studio uses the same class-naming convention as the widely used open-source project . Some of the fundamental class names are:

Simple-Keyboard
⚠️
ℹ️
✔️
On-Screen Keyboard
Creating an On-Screen Keyboard.
Creating the Layout File
Adding a Custom Layout
Styled Keyboard.
Design Result.
1. Initialization.
2. Field Selection.
Form Submission.
Data Manipulation.
Hub