[fxruby-users] Directory listing query

Stuart Clarke stuart_clarke86 at yahoo.com
Thu Dec 18 11:53:38 EST 2008


Apologies I was sending a chunk of the wrong coding. This is more useful I would imagine:

    inputFile = FXButton.new(frame, "Input Phrase File")
    inputFile.connect(SEL_COMMAND) do #the connect will ensure the following block is performed
      dialog = FXFileDialog.new(self, "Select input file")
      dialog.patternList = ["Text Files (*.txt)", "All Files (*)"]
      dialog.selectMode = SELECTFILE_EXISTING
      if dialog.execute != 0 #display the box and wait fot user response
        inputfield.text = dialog.filename
      end
    end
    #create a text field to insert file path in
    inputfield = FXTextField.new(frame, 30, :opts => FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)

This throws errors. Do I need a to_s?

Thanks in advance!

--- On Thu, 18/12/08, Lyle Johnson <lyle at lylejohnson.name> wrote:
From: Lyle Johnson <lyle at lylejohnson.name>
Subject: Re: [fxruby-users] Directory listing query
To: fxruby-users at rubyforge.org
Date: Thursday, 18 December, 2008, 3:50 PM


On Dec 17, 2008, at 3:51 PM, Stuart Clarke wrote:
Firstly when a user selects a file (word list file) I would like the full path and file name to be displayed in a text box (I would like the same for the directory selection also). How would I go about this?
I don't see in your program (or at least the part that you included in your e-mail) where you've attempted to do this, so it's hard to guess what's wrong. But since the FXFileDialog#filename returns the selected file's name, it seems like you'd want to assign that to the appropriate text field, e.g.
	@inputfield.text = dialog.filename

Hope this helps,
Lyle_______________________________________________
fxruby-users mailing list
fxruby-users at rubyforge.org
http://rubyforge.org/mailman/listinfo/fxruby-users


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081218/fb170d13/attachment.html>


More information about the fxruby-users mailing list