Skip to content

Editing NumberStepper textfields creates runtime error #37

@mundusnine

Description

@mundusnine

When editing textfields of numbersteppers with float values if we press repeatedly the arrows to select a section and then try to use backspace to remove text we create an error in how the fonts are rendered.

Expected Behavior

No bug should occur when editing the textfield of a numberstepper. I.e. the issue could be coming from the numberstepper adding to the pos value when using the arrow keys.

Current Behavior

When trying to edit textfields of numbersteppers it's bug out and jams the UI. The error message in the debug console outputs this:

TypeError: Cannot read property 'xadvance' of undefined
    at kha_KravurImage.getCharWidth (/home/jsnadeau/Kha/Sources/kha/Kravur.hx:99:28)
    at kha_KravurImage.charactersWidth (/home/jsnadeau/Kha/Sources/kha/Kravur.hx:117:13)
    at kha_Kravur.widthOfCharacters (/home/jsnadeau/Kha/Sources/kha/Kravur.hx:207:15)
    at haxe_ui_backend_kha_TextField.render (/home/jsnadeau/foundsdk/haxeui-kha/haxe/ui/backend/kha/TextField.hx:866:44)
    at haxe_ui_core_TextInput.renderTo (/home/jsnadeau/foundsdk/haxeui-kha/haxe/ui/backend/TextInputImpl.hx:101:9)
    at haxe_ui_components_TextField.renderTo (/home/jsnadeau/foundsdk/haxeui-kha/haxe/ui/backend/ComponentImpl.hx:163:13)
    at haxe_ui_components_NumberStepper.renderTo (/home/jsnadeau/foundsdk/haxeui-kha/haxe/ui/backend/ComponentImpl.hx:169:13)

Possible Solution

If the issue is coming from the numberstepper incrementing/decrementing to the pos value when using the arrow keys removing this feature when editing the text could be a solution.

Steps to Reproduce (for bugs)

  1. Start editing textfield of numberstepper
  2. Try selecting a section, then use backspace while using the arrows.

Media

Test app / minimal test case

Context

Trying to have editable numbersteppers

Your Environment

  • Version used: haxeui-kha git version
  • Environment name and version (e.g. Chrome 39, node.js 5.4): kha debug-html5
  • Operating System and version (desktop or mobile): Linux debian 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions