User Tag List

Results 1 to 3 of 3

Thread: Disabling Characters in Edit Box

  1. #1
    No Products Registered

    Join Date
    May 2013
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Disabling Characters in Edit Box

    I've just been trying to solve the problem of stopping users from entering certain characters into an Edit Box and I've found quite a simple method of doing so which I didn't see when searching the forums and googling.

    This method does render the Undo function a bit useless but I don't think that's too big an issue for most people. Also, apologies if people have their own methods or better methods, I just thought I'd share for people with a similar problem in future who are also searching the forums.


    Basically, this method just consists of clearing the Undo buffer every time the Edit Box entry zone has been modified, and if the Edit Box entry zone has been modified and an unwanted character has been found in the entry zone then Undo; so only the last character input is disabled. This disables copy/pasting as well as any single character input, at any point within the string.

    Events are as follows:

    Code:
    +Edit Box has just been modified
    +Find ( Edittext$( "Edit Box" ), "*", 0 )
    - Undo
    
    +Edit Box has just been modified
    - Clear undo buffer
    Simply replace the * to disable the characters of your choosing.


    EDIT: I assumed adding more Find events would enable you to disable more characters but upon further use I've noticed you'll have to duplicate the entire first event to disable extra characters. This may get messy if you're trying to disable many characters (all symbols, for example) but works great if you're just trying to disable spaces like I was.

  2. #2
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Disabling Characters in Edit Box

    A method that works for my needs was to have two edit boxes. A primary and a mirror. Whenever the primary edit was modified, that character was compared to a string of allowable characters. If it was found to be allowable, that character was added to the mirror edit box, then cleared from the primary edit. If the character was not found to be allowable, it was cleared from the primary edit and not added to the mirror. It worked well and the user didn't really know this was happening behind the scenes once Looki's edit cursor extension was also implemented.

  3. #3
    No Products Registered

    Join Date
    May 2013
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah yeah, I should probably mention that this came about because my project doesn't allow the use of third party extensions. Most methods I tried first would always set the Edit Box carat back to the start of the text which was a big annoyance. The main advantage of my method was that it didn't involve the use of extensions and worked mostly as I had hoped, but anyone not plagued by this restriction should probably look up extensions for their needs

Similar Threads

  1. Limiting Edit Object characters
    By KLiK-iT in forum Fusion 2.5
    Replies: 6
    Last Post: 6th March 2016, 04:25 PM
  2. Removing characters from Edit Box/String
    By Jaklar in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 7th May 2013, 03:05 PM
  3. Register Characters Typed in Edit Box
    By Top_of_the_Temple in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th December 2012, 10:08 PM
  4. Count number of characters in a text edit?
    By daniele in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th June 2012, 01:33 PM
  5. Edit Box disable invalid characters
    By lordzero in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 22nd May 2009, 11:01 PM

Posting Permissions

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