• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Testing user input as valid geo-location

Scheduled Pinned Locked Moved Developers' Forum
7 Posts 4 Posters 286 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    honoluludesktop
    last edited by honoluludesktop 28 Nov 2010, 23:43

    I tried to test UI.inputbox to validate the user_input location:

    result=shadowinfo["City"]=user_input

    The API is as follows:

    ShadowInfo.[=

    The set value []= method is used to set the value in the array of shadow info options.
    Arguments:
    key The key of the shadowinfo value to set.
    value The value to be set.
    Returns:
    value the value that was set if successful, or false if unsuccessful.]

    When the user_input is a bogus location, the value (return) is not false but the bogus location. The resulting longitude, and latitude are from the previous correct location.

    Am I doing something wrong? What method can be used to test the user_input for a real geo-location besides a convoluted test of previous against new longitude, and latitude?

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 29 Nov 2010, 07:04

      @honoluludesktop said:

      result=shadowinfo["City"]=user_input

      You're using the assign operation = instead of the evaluation operator ==

      result == (shadowinfo["City"] == user_input)

      (I'm not sure if the brackets are required to correctly evaluate that line, so I add it for safety and readability.)

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • H Offline
        honoluludesktop
        last edited by 29 Nov 2010, 17:19

        This is going to take time, I can't get the code to work.

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 29 Nov 2010, 17:41

          😳

          result = (shadowinfo["City"] == user_input)

          πŸ˜„

          There!

          πŸ˜• 😳

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by 29 Nov 2010, 17:42

            Thom made a very similar typo in his example. Should be:

            result = (shadowinfo["City"] == user_input)

            Hi

            1 Reply Last reply Reply Quote 0
            • D Offline
              Dan Rathbun
              last edited by 30 Nov 2010, 09:54

              @honoluludesktop said:

              The API is as follows:

              ShadowInfo.[=SketchUp
              The set value []= method is used to set the value in the array of shadow info options.
              ....]

              Delete the word "Sketchup" (you got it from the righthand version column. It's not part of the text.)

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • H Offline
                honoluludesktop
                last edited by 30 Nov 2010, 13:58

                Done, Thanks Dan. 😳

                Haven't gotten back to working on this part of the code yet.

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                1 / 1
                • First post
                  2/7
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement