Using FXRuby basic window

Dark_Omen 0 Tallied Votes 227 Views Share

This is a basic window coded in Ruby. To download Ruby go to www.ruby-lang.org and download the latest version. The latest version includes the FX toolkit that is needed to create this window.

require 'fox'
include Fox

theApp = FXApp.new

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

theMainWindow.show

theApp.run
Dark_Omen 5 Posting Pro

I realized I didn't mention what exactly to download. On www.ruby-lang.org, on the right side there is a thing that says download. Once you are on that page find the link that says one click installer. This comes with FreeRIDE which you can write the programs and run them in. Also I download one of them to see if it worked, and it didn't (the final version). The only one that I know of that works is 1.8.2 rc 9, and they dont have it posted, but I can e-mail it to anybody upon request.

vegaseat 1,735 DaniWeb's Hypocrite Team Colleague

Greetings Dark! I downloaded Ruby. The sample codes look a little like a mix of Python, Java and C. Got the FreeRide IDE going, cute, but nothing shows up in the output window after running the code. Is there a trick?

Dark_Omen 5 Posting Pro

Does a dos promt window open as well as a normal looking window? Did you get FXRuby. You can get the one click installer and that would get you everything you need. I don't think the final version is working properly, but I have a working one that I can send you if you want.

vegaseat 1,735 DaniWeb's Hypocrite Team Colleague

The samples I ran were console samples that came with Ruby. I was hoping the results would show up in the Output View of FreeRide. Looks like I have to put the directive #!/usr/bin/env ruby in at the start of code to get the console compiled properly (similar to Python). I will test your code after I installed FOX and FXRuby. Thanks...

Dark_Omen 5 Posting Pro

Yup

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.