954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

More using the FXRuby

0
By Dark_Omen on Jan 22nd, 2005 4:22 am

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

Right from the example code! Come on, you can do better!

bumsfeld
Nearly a Posting Virtuoso
1,445 posts since Jul 2005
Reputation Points: 404
Solved Threads: 184
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You