User Tag List

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

Thread: Edit box question

  1. #1
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Edit box question

    Hi, this may seem kinda dumb but I tried a lot of things and they didn't work so yeah. I'm working on an application where a user needs to enter their desired name into an Edit Box, but I don't want there to be spaces in their name. Is there any condition I can use to check if there are no spaces in an edit box?

  2. #2
    Clicker Multimedia Fusion 2 DeveloperHTML5 Export ModuleSWF Export ModuleInstall Creator Pro
    drnebula's Avatar
    Join Date
    Jul 2006
    Location
    Pennsylvania, USA
    Posts
    908
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    You could try the masked edit object. It might just be available for MMF 2 Pro - I can't remember.
    Steve

  3. #3
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    I tried using the Kernel object to trap On_Char messages, however it doesn't get as far as the Kernel object (Suggestion: Could the kernel object handle messaqes before the object?) and so you can't do that (You could see if it was a space and just discard it if it is. That is how you'd do it in C).

    Anyway, the cheap solution is just to set the background red or something if you find "Find(Edittext$( "Edit Box" ), " ", 1)" is lower than or equal to zero (providing the text-box is non-empty)

  4. #4
    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,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    Learn how to use the String functions. You find them under the Special icon.

    It is quite easy, anyway, I'll take you through it step by step.

    When the user click the button to submit their name, start a fastloop. Name the loop "findWhitespace".
    The fastloop need to be as long as the entered name. To get the length of the name, select Retrieve data from object, click on the System icon, and select Strings / Length of string.

    Next make a new event with an onloop condition. The name of the loop must be the same as the loop you created in the other event.

    You also need to test if the current character in the loop is equal to " ". To do that, make a compare two general values condition. As the first value, hit the Retrieve data from object button and select string / 'extract middle substring' from the Special icon.

    You will have to input 3 values. The first one is the entered name. Retrieve it from the edit object. The second one is the character you test for, which should be the current loopIndex. Retrieve that from the Special icon: Fastloops / get loop index.
    Set the last value to 1, since we test one character.

    Compare this with " " and click OK. If this condition is true it means the name should not be allowed, so you will have to set a value to something so mmf knows that the button shall not perform an action.

    I would simply make a string and write an errormessage if the name contains whitespace. Then test if the string have not gotten the errormessage.

    Here's the code for you:

    [color:#FF0000]* user clicks on the button[/color]
    - start loop "findWhitespace"
    - String1: set alterable string to "valid".

    [color:#FF0000]* on loop findWhitespace"[/color]
    + Mid$(Edittext$( "Edit_name" ), LoopIndex("yourloop"), 1)
    equals " "
    - String1: set alterable string to "sorry, name must not contain whitespace"

    [color:#FF0000]* user clicks on the button[/color]
    + String1: alterable string equals "valid"
    - do your thing

  5. #5
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    Thanks popcorn! I had some trouble at first but I found out I was starting the loop before setting the string to Valid(when the user clicks the button). Thanks, it works great now.

  6. #6
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    You can just use the Find function rather than use a fastloop though...

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export Module

    Join Date
    Jun 2006
    Location
    Derby, United Kingdom
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    Or string manipulator and replace " " with ""

  8. #8
    Clicker Multimedia Fusion 2 Developer
    Jax's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    702
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    Problem is with that is it will reset the cursor and I don't think there are methods for putting it back?

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export Module

    Join Date
    Jun 2006
    Location
    Derby, United Kingdom
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Edit box question

    I'm not sure I don't have MMF infront of me to test it. But I have used the string manipulator object and just stored the data without spaces rather than removing the spaces in runtime...

  10. #10
    RayMarble
    Guest

    Re: Edit box question

    Wouldn't it be the easiest to just disable / ignore the spacebar during typing?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. edit box and grading question
    By brett in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 20th May 2013, 11:46 PM
  2. Registry edit question
    By ratty in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 25th March 2013, 06:26 PM
  3. Edit Object Color Question
    By Cossin in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th December 2010, 12:58 PM
  4. Edit Box object question
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 15th November 2007, 11:20 PM
  5. Simple question about edit box
    By Bruto in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 6th September 2006, 08:21 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
  •