Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 37199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:30:47+00:00 2026-05-10T14:30:47+00:00

In FXRuby; how do I set the FXFileDialog to be at the home directory

  • 0

In FXRuby; how do I set the FXFileDialog to be at the home directory when it opens?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T14:30:48+00:00Added an answer on May 10, 2026 at 2:30 pm

    Here’s an exceedingly lazy way to do it:

    #!/usr/bin/ruby require 'rubygems' require 'fox16' include Fox  theApp = FXApp.new  theMainWindow = FXMainWindow.new(theApp, 'Hello')  theButton = FXButton.new(theMainWindow, 'Hello, World!') theButton.tipText = 'Push Me!'  iconFile = File.open('icon.jpg', 'rb') theButton.icon = FXJPGIcon.new(theApp, iconFile.read) theButton.iconPosition = ICON_ABOVE_TEXT iconFile.close  theButton.connect(SEL_COMMAND) {  fileToOpen = FXFileDialog.getOpenFilename(theMainWindow, 'window name goes here', `echo $HOME`.chomp + '/') }  FXToolTip.new(theApp)  theApp.create  theMainWindow.show  theApp.run 

    This relies on you being on a *nix box (or having the $HOME environment variable set). The lines that specifically answer your question are:

    theButton.connect(SEL_COMMAND) {  fileToOpen = FXFileDialog.getOpenFilename(theMainWindow, 'window name goes here', `echo $HOME`.chomp + '/') } 

    Here, the first argument is the window that owns the dialog box, the second is the title of the window, and the third is the default path to start at (you need the ‘/’ at the end otherwise it’ll start a directory higher with the user’s home folder selected). Check out this link for more info on FXFileDialog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I installed fxruby using $sudo port install rb-fxruby As suggested in the book. It
Well, I tried Shoes, Titanium, and RubyFX (or was it FXRuby?) and am not
I encounter an issue in building FXRuby from source. Below are the steps I
I've got an idea for an idiotically simple application, one that converts HAML and
I know that cross platform GUIs can be built in Ruby using various tools
I want to use Aptana Studio 3 Beta for all my Ruby developments. I
I want to write a small reporting tool and looking to fetch data from
I am trying to settle on a GUI framework for Ruby and I have
I just install rails 3 and all gems that it need, but when I
so let me preface this with the fact that I am a beginner at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.