User Tag List

Results 1 to 4 of 4

Thread: Question about manipulating user entered text (performing a calculation)

  1. #1
    No Products Registered

    Join Date
    Jun 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question about manipulating user entered text (performing a calculation)

    Hello! I am trying out MMF2, and am having some issues with performing a calculation on some user entered text. I have been working on creating an iOS app with some financial calculators in Corona SDK, and thought it might be interesting to try it in MMF2.

    I am using a pair of iOS Single Line Edit boxes, as well as an iOS button. I have been able to get input text to display in a string object by using a button clicked event to set an alterable string to Text$( "editBox1" ), then displaying the alterable text. The problem I am having is two fold; one being that this text is a string and not an int, and two is that I cannot figure out how to get the two values converted to intergers and perform a simple calculation on them.

    Ideally I would be able to set the alterable string to Val( "editBox1" ) + Val( "editBox2" ), but when I do that it asks me to enter an alphanumeric string. When I try to use just Val( "editBox1" ) it gives me that same error.

    I know that this function exists, I am just not finding any reference to how to perform the task. Any help would be greatly appreciated!

    Sean

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    May 2012
    Location
    NSW, Australia
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi. Maybe try:
    Set alterable string to:

    This gets the numeric value of the edit boxes, adds together and converts to string
    Str$(Edit Value( "Edit Box 1" )+Edit Value( "Edit Box 2" ))

    or

    This gets the text, converts them to values, adds together, converts back to string
    Str$(Val(Edittext$( "Edit Box 1" ))+Val(Edittext$( "Edit Box 2" )))

    Both produce the same outcome.

    What you were doing was correct, however you just needed to encompass it all and covert to a string.

  3. #3
    No Products Registered

    Join Date
    Jun 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by macca02 View Post
    Str$(Edit Value( "Edit Box 1" )+Edit Value( "Edit Box 2" ))

    or

    Str$(Val(Edittext$( "Edit Box 1" ))+Val(Edittext$( "Edit Box 2" )))
    I tried both of the strings you suggested, but it wasn't working for me. However, expanding upon your suggestion I was able to come up with Str$(Val(Text$( "editBox1" ))+Val(Text$( "editBox2" ))) and that does seem to work. Now, if I can figure out how to clear the text when clicking the button I think I will be in business. Thanks!

    Sean

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module

    Join Date
    May 2012
    Location
    NSW, Australia
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The example i used was with the Edit Box. but i'm guessing the edit box for IOS is different thats why the expression didn't work.
    To clear the edit box from a button press:

    *Button clicked:
    Set text to ""

    That essentially clears it.

    Is that what you're after or something else?

    Hope it helps!

Similar Threads

  1. Quick Question Regarding Text Objects VS Graphic Made With Text
    By Rolando in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 7th April 2013, 04:10 AM
  2. Check if text has been entered?
    By blub in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 21st March 2012, 04:07 PM
  3. Help! All enemies performing same action!
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 23rd September 2008, 12:03 PM
  4. manipulating any act. obj. that fits a condition
    By Hamcraft in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 14th July 2008, 01:36 PM
  5. File performing badly after conversion to MMF2
    By Crash86 in forum Multimedia Fusion 2 - Technical Support
    Replies: 21
    Last Post: 14th June 2007, 12:56 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
  •