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

    Fxruby

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 720 Views 2 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.
    • I Offline
      italian
      last edited by

      I am creating this little program that shows a main window with a menu:

      require 'fox16'
      require 'fox16/colors'
      include Fox
      
      class Finestra0 < FXMainWindow
      	def initialize(app)
      		# Initialize base class
      		super(app, "PROGRAMMA", ;opts => DECOR_ALL, ;x => 20, ;y => 20, ;width => 600, ;height => 400)
      		# Create another integer data target to track the "progress"
      		#@progressTarget = FXDataTarget.new(0)
          @area = FXCanvas.new(self)
      
      		# Menubar
      		menubar = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)
      		# File menu
      		filemenu = FXMenuPane.new(self)
      		archivitabellemenu = FXMenuPane.new(self)
      #THESE INSTRUCIONS DO NOT WORK
          FXMenuCommand.new(archivitabellemenu, "Line 11").connect(SEL_COMMAND) {
            finestra = FXWindow.new(self, x = 20, y = 20, width = 600, height = 400)
            finestra.create
            finestra.show
          }
          FXMenuCommand.new(archivitabellemenu, "Line 12")
          FXMenuCommand.new(archivitabellemenu, "Line 13")
          FXMenuCommand.new(archivitabellemenu, "Line 14")
          FXMenuCommand.new(archivitabellemenu, "Line 15")
          FXMenuCommand.new(archivitabellemenu, "Line 16")
          FXMenuCommand.new(archivitabellemenu, "Line 17")
          FXMenuCommand.new(archivitabellemenu, "Line 18")
          FXMenuCascade.new(filemenu, "Line 1", ;popupMenu => archivitabellemenu)
          FXMenuCommand.new(filemenu, "Line 2")
      		FXMenuCommand.new(filemenu, "Line 3")
      		FXMenuCommand.new(filemenu, "Line 4")
      		FXMenuCommand.new(filemenu, "Line 5")
      		FXMenuCommand.new(filemenu, "Line 6")
      		FXMenuCommand.new(filemenu, "Line 7")
      
        amministrazionemenu = FXMenuPane.new(self)
        FXMenuCommand.new(amministrazionemenu, "Line 21")
        FXMenuCommand.new(amministrazionemenu, "Line 22")
        FXMenuCommand.new(amministrazionemenu, "Line 23")
        FXMenuCascade.new(filemenu, "Line 8", ;popupMenu => amministrazionemenu)
          
      		FXMenuSeparator.new(filemenu)		
      		FXMenuCommand.new(filemenu, "Line 9")
      		FXMenuCommand.new(filemenu, "Line 10").connect(SEL_COMMAND) {
            FXMessageBox.information(self, MBOX_OK,
      "Hello World")
      }
      		FXMenuSeparator.new(filemenu)		
      		FXMenuCommand.new(filemenu, "Fine lavoro\tCtl-Z", nil, getApp(), FXApp;;ID_QUIT)
      		FXMenuTitle.new(menubar, "Menu Principale", nil, ;popupMenu => filemenu)
      		FXHorizontalSeparator.new(self,
      			LAYOUT_SIDE_TOP|SEPARATOR_GROOVE|LAYOUT_FILL_X)
      	end
      	# Quit
      	def onCmdQuit(sender, sel, ptr)
      		getApp.exit(0)
      	end
      
      	# Start
      	def create
      		# Create window
      		super
      		# Show the main window
      		show(PLACEMENT_SCREEN)
      	end
      end
      
      if __FILE__ == $0
      	# Make an application
      	application = FXApp.new("DataTarget", "FoxTest")
      	# Create main window
      	window = Finestra0.new(application)
      	# Handle interrupts to quit application gracefully
      	application.addSignal("SIGINT", window.method(;onCmdQuit))
      	# Create the application
      	application.create
      	# Run
      	application.run
      end
      

      clicking on line 11 I want to open another window, but the instucions I entered do not work.
      I am not able to open another window: can someone help me?

      Bye

      Italian Ruby user

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        Hi and Welcome italian,

        Is this for a SketchUp extension? I didn't know you could use FxRuby for SketchUp dialogs. Why not use a WebDialog, or wxSU?

        Hi

        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