sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    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.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by honoluludesktop

      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
      • thomthomT Offline
        thomthom
        last edited by

        @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
        • honoluludesktopH Offline
          honoluludesktop
          last edited by

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

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            😳

            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

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

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

              Hi

              1 Reply Last reply Reply Quote 0
              • Dan RathbunD Offline
                Dan Rathbun
                last edited by

                @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
                • honoluludesktopH Offline
                  honoluludesktop
                  last edited by

                  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
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement