sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Using the Cancel btn, to return to previous menu?

    Scheduled Pinned Locked Moved Developers' Forum
    22 Posts 5 Posters 616 Views 5 Watching
    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.
    • TIGT Offline
      TIG Moderator
      last edited by

      Here's an example I know works as I have tested it...

      require('sketchup.rb')
      module CANCEL_TEST
      	#Set default settings
      	@height = 9.feet if not @height # floor to floor height   
      	@riser = 16 if not @riser       # no. risers total   
      		
      	def self.run()   
      		self.dialog1()
      	end
      	# Dialog box #1
      	def self.dialog1()
      		prompts = ["Floor/Floor Height ", "No. Risers"]
      		values = [@height, @riser]
      		@results1 = inputbox prompts, values, "Dialog Box #1"
      		if @results1
      			@height, @riser = @results1
      			@riserheight=@height/@riser  # riser height
      			self.dialog2()
      		else
      			return nil
      		end
      	end
      
      	# Dialog box #2
      	def self.dialog2()
      		prompts = ["My RiserHeight  ", "--------"]
      		values = [@riserheight, @any_entry]
      		@results2 = inputbox prompts, values, "Dialog Box #2"
      		if @results2
      			@riserheight, @any_entry = @results2
      			puts "Got here !"
      			[@height,@riser,@riserheight,@any_entry].each{|e| puts e}
      		else
      			self.dialog1()
      			return nil
      		end   
      	end
      
      	###
      	unless file_loaded?(__FILE__)
      		UI.menu("Plugins").add_item("Cancel") { CANCEL_TEST.run() }
      	end
      	###
      	file_loaded(__FILE__)
      
      	# load"CANCEL_TEST.rb"
      end#module
      
      

      IT is now properly structured to loop back into itself is needs be... πŸ˜’

      TIG

      1 Reply Last reply Reply Quote 0
      • T Offline
        tomot
        last edited by

        Thanks TIG:

        I would never have been able to figure out the self.run routine on my own! πŸŽ‰

        [my plugins](http://thingsvirtual.blogspot.ca/)
        tomot

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

        Advertisement