• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Enums's index of an inputbox return

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 2 Posters 302 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.
  • S Offline
    shirazbj
    last edited by 1 Apr 2011, 03:45

    hi,

    I was wondering if I could get the index of an enums selection directly.

    In my example below, I want to choose between "2D" & "3D" for one variable. The return is either "2D" or "3D". But I want the index number instead, that is "0" for "2D", "1" for "3D".

    How could I get the "0" or "1" if I don't compare the return with the list of the enums.

    Thanks in advance

    Cean

    def hw_inputbox
    	
      iaxi=1	
      t_iaxi = ["2D","3D"]
      enums = [t_iaxi.join("|")]
      values = [t_iaxi[iaxi]]
      prompts = ["Geo type; "]
      results = inputbox prompts, values, enums, "my Geo"
      return nil if not results 
      $iaxi = results[0]
      your_slection=$iaxi
      UI.messagebox(your_slection)
    
    end
    
    UI.menu("Plugins").add_item("hw_inputbox") { hw_inputbox }
    
    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 1 Apr 2011, 05:00


      your_selection = t_iaxi.index( results[0] )


      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        Dan Rathbun
        last edited by 1 Apr 2011, 05:04

        By the way Cean.. have you downloaded the CHM Reference for Standard Ruby 1.8.6 ??

        It's posted here:
        http://forums.sketchucation.com/viewtopic.php?f=180&t=10142&p=266725#p266725

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • S Offline
          shirazbj
          last edited by 2 Apr 2011, 12:32

          all good now.

          I'll download the ruby book.

          Thanks dan.

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

          Advertisement