sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Using the Cancel btn, to return to previous menu?

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    22 貼文 5 Posters 949 瀏覽 5 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • TIGT 離線
      TIG Moderator
      最後由 編輯

      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 條回覆 最後回覆 回覆 引用 0
      • T 離線
        tomot
        最後由 編輯

        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 條回覆 最後回覆 回覆 引用 0
        • 1
        • 2
        • 2 / 2
        • 第一個貼文
          最後的貼文
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement