foxGUIb

GUI Creator for Ruby + Fox

Guide Contents

Source Code of Inches.rb

# source generated by foxGUIb

class Inches
	def initialize( parent)
		construct_widget_tree( parent)
		init if respond_to? 'init'
	end
	
	def construct_widget_tree( parent)
		@topwin=
		FX::MainWindow.new(parent){|w|
			@MainWindow=w
			w.wdg_name='MainWindow'
			w.shown=true
			w.y=294
			w.height=66
			w.x=412
			FX::Button.new(@MainWindow){|w|
				@convertButton=w
				w.wdg_name='convertButton'
				w.text="Convert to cm"
				w.font=Font.new.from_s('Tahoma|100|400|1|0|0|0').to_FXFont
				w.width=88
				w.height=24
				@convertButton.connect(SEL_COMMAND){
						cmLabel.text=(inchesField.text.to_f * 2.54 ).to_s
						
				}
			}
			FX::TextField.new(@MainWindow){|w|
				@inchesField=w
				w.wdg_name='inchesField'
				w.font=Font.new.from_s('Tahoma|100|400|1|0|0|0').to_FXFont
				w.width=76
				w.y=24
				w.height=22
				w.numColumns=10
			}
			FX::Label.new(@MainWindow){|w|
				@cmLabel=w
				w.wdg_name='cmLabel'
				w.font=Font.new.from_s('Tahoma|100|400|1|0|0|0').to_FXFont
				w.width=34
				w.y=46
				w.height=20
			}
		}
	end
	attr_reader :topwin
	attr_reader :MainWindow
	attr_reader :convertButton
	attr_reader :inchesField
	attr_reader :cmLabel
end

#unit test
if __FILE__==$0
      require 'libGUIb16'
      app=FX::App.new
	w=Inches.new app
	w.topwin.show(0)
	app.create
	app.run
end

 


Guide Contents