0

Okay, this introduces two new things into the widget. The first thing you need is a picture file (.jpg, .png, .bmp etc...). The new code makes the picture into the button with the text "Hello, World" on the side. In the parentheses next to File.open you would put the file name with its appropriate extension. On the next line you would say FX"filetype"Icon. This code snippet also includes another part called tipText. When you go ontot the button with the mouse it will say "exit". I saved the file I was using with the .rb file (I don't know if it has any effect on the program, you can try and post it in the coments if it does have any effect).

require 'fox'
include Fox

theApp = FXApp.new

theMainWindow = FXMainWindow.new(theApp, "Hello, World")

theButton = FXButton.new(theMainWindow, "Hello, World")
theButton.tipText = "Exit!"
iconFile = File.open("hwrb.png", "rb")
theButton.icon = FXPNGIcon.new(theApp, iconFile.read)
iconFile.close
theButton.connect(SEL_COMMAND) {exit}

FXTooltip.new(theApp)
theApp.create
theMainWindow.show
theApp.run
2
Contributors
1
Reply
3
Views
12 Years
Discussion Span
Last Post by bumsfeld
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.