当前位置: 首页 > 工具软件 > fxruby > 使用案例 >

FXRuby代码笔记---hello.rb (button with a icon)

姚新霁
2023-12-01
require 'fox16'

include Fox

app = FXApp.new


main = FXMainWindow.new(app, "Hello, World!")

button=FXButton.new(main, "Hello, World!")

button.tipText = "Push Me!"

 以上参见http://vivimusing.iteye.com/admin/blogs/224541

File.open("ruby.jpg", "rb") do |iconFile|
	button.icon = FXJPGIcon.new(app, iconFile.read)
	button.iconPosition= ICON_ABOVE_TEXT
end

FXJPGIcon.new (a, pix=nil, clr=0, opts=0, width=1, height=1) {|theJPGIcon| ...}

a=>FXApp实例[app]

pix=>以jpg格式的数据流[iconFile.read]

 

button.connect(SEL_COMMAND) do |sender,selector,data|
	exit
end

FXToolTip.new(app)


app.create


main.show(PLACEMENT_SCREEN)

app.run

 以上参见http://vivimusing.iteye.com/admin/blogs/224541

 类似资料: