User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Using custom virtual keyboard to type text

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using custom virtual keyboard to type text

    I am wondering how I might use a custom virtual keyboard to type text in to an edit box in Fusion?

    Essentially I am using it as a means for entering players highscores after a game, but I have no experience using edit boxes or strings.

    Let's say for example the player pressed "a" on the virtual keyboard (one that I designed with active objects), how would that then translate to typing 'a' as the start of a string?
    And then say I pressed "b" on the virtual keyboard, how would I then add that to 'a' as the second letter in the string?
    And what if I wanted to then backspace and erase a letter?

    It's the typing letters and converting them to a string that I'm having trouble getting my head around.

    Thanks
    Simflare

  2. #2
    Clickteam Clickteam
    Fernando's Avatar
    Join Date
    Dec 2006
    Posts
    7,376
    Mentioned
    298 Post(s)
    Tagged
    4 Thread(s)
    you can use a sub app application for that make a layout for chars, symbol and numbers, and you should be OK if you start subapp when keyboard is need it and to jump from chars to numbers the change of frame in sub app should do it. so keep in mind to start subapp using frame x for chars and frame x+1 for symbols/numbers, you can use easing object for movement.

    translate the key code each key have a fixed value this value represent the char value, so when you want to translate take this fixed value and compare to a table of string search for it (could be a list, array, ini) and take this value and append to the editbox.

    do the same for backspace just backward take the editbox content and delete the last char
    Regards,


    Fernando Vivolo

    ... new things are coming ...

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,372
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Add "A" to the current text of the editbox:
    Set current text of the editbox to: Edittext$( "Edit Box" )+"A"
    You might want to use an alterable string of the active object that's being pressed instead of hardcoding the actual letter.

    Remove the last letter from the editbox:

    Set current text of the editbox to: Left$(Edittext$( "Edit Box" ), Len(Edittext$( "Edit Box" ) ) - 1 )

    That said, you most probably want to use a string object or Active System Object instead of an editbox, as Edibboxes are intended to be directly edited by the user.

    You will find all stringrelated expressions such as Len and Left$ in the Strings dropdown menu of the Special icon in the expression editor.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you guys.

    Popcorn, your solution sounds very simple and effective. In terms of using a string object, would I achieve it the same way?

    Add "A" to String object
    So, Change Alterable String of <String Object> to : string$(<String Object>) + "A" ?

    Is that how you'd achieve it?

    Edit

    I achieved it using the string object by setting an alterable string called 'Letter' to "a" (used for storing the current value of the letter I want to type), then having a separate an alterable string called 'Text' to store the actual string text, which became:

    Set 'Text' to Text("object B") + Letter("object A")

    What I can't figure out now is how to backspace it and remove a letter from the Text string. Can you help with that please?
    I tried 'Len(Text("object B") - 1' but I kept getting syntax errors. It didn't like the Len(Text("object B"). I guess the issue is what's the correct way to get the length of an alterable string?

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,372
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    It seems like you forgot a parantheses. The correct syntax would be:
    Len(Text("object B")) - 1

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Erase Letter In String Test

    Ah true but that was just a typo when I pasted it, I typed it right in the software. I'll attach the file and maybe you could have a look? At the bottom of the group "set text" I've got an event for pressing backspace but with nothing in it. If you could help figure it out, that'd be amazing!

    Thanks
    Simflare
    Attached files Attached files

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Btw I should add, the Alterable String "Text" that we want to change is located in the green square called "Active 2".

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,372
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Got it. In Event 32, set Alterable Value Text of Active 2 to:
    Left$(Text( "Active 2" ), Len(Text( "Active 2" ) ) - 1 )

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Simflare's Avatar
    Join Date
    Oct 2013
    Location
    Australia
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you! That works brilliantly!

    Could you please explain to me what that line is doing? I don't understand the need for the Left$() paramater.

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,372
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    The Left$ expression is found in the expression editor under Special -> Strings -> Substrings and retrieves the left part of the string

    Format: Left$(String, Length of substring)

    This is useful since we want to retrieve all the letters in the string beside the last one. The length of the substring will therefore be the full length of the string minus 1.

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Virtual PC keyboard \ Clavier virtuel PC ?
    By duwayy in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 18th June 2013, 07:33 PM
  2. [SAMPLE] Virtual Keyboard
    By BackStaged in forum File Archive
    Replies: 0
    Last Post: 13th June 2013, 09:17 PM
  3. OUYA - Virtual keyboard
    By Rushino in forum Android Export Module Version 2.0
    Replies: 4
    Last Post: 3rd April 2013, 05:38 PM
  4. Orientation of the iOS-Virtual Keyboard on iPad
    By jimmyorpheus in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 24th October 2011, 07:15 PM
  5. virtual keyboard for touch screen
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 8th September 2011, 12:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •