Thread: Re: [Fxruby-users] Default associations in FXFileList and FXDirList
Status: Inactive
Brought to you by:
lyle
From: <kun...@ho...> - 2003-09-12 16:11:26
|
ly...@kn... wrote: > The current FXRuby release(s), numbered 1.0.x, are only for use with FOX > 1.0.x releases. Because FOX 1.1 is an unstable development series, there > will be no FXRuby 1.1 releases. As soon the current FOX 1.1 development line > is released as FOX 1.2 (i.e. as the new "stable" branch"), there will be a > compatible FXRuby 1.2. > So, this means I'm out of luck with the "fixed" FXDirList widget then? -- Kristoffer -- Sent using: Mozilla Thunderbird 0.2 (20030901) http://www.mozilla.org/projects/thunderbird/ |
From: jeroen <je...@fo...> - 2003-09-13 05:22:34
|
On Friday 12 September 2003 11:13 am, you wrote: > On Fri, 12 Sep 2003 18:10:19 +0200, Kristoffer Lund=E9n <kung.stoffe@ho= me.se> > > wrote : > > So, this means I'm out of luck with the "fixed" FXDirList widget then= ? > > Yes, unless Jeroen chooses to back-port the fix(es) to the FOX 1.0 bran= ch. Well, I only fix what's known to be broken, and AFAIK, it isn't... I just checked again; a call to dirbox->setDirectory("d:\"); switches FXDirList's display to that of the D: drive as expected (FXDirDi= alog has a drive box and switching drive letters with it works). - Jeroen --=20 +------------------------------------------------------------------------= ----+ | Copyright (C) 21:40 09/12/2003 Jeroen van der Zijp. All Rights Reserv= ed. | +------------------------------------------------------------------------= ----+ |
From: <kun...@ho...> - 2003-09-13 08:29:08
|
jeroen wrote: > Well, I only fix what's known to be broken, and AFAIK, it isn't... I just > checked again; a call to > > dirbox->setDirectory("d:\"); > > switches FXDirList's display to that of the D: drive as expected (FXDirDialog > has a drive box and switching drive letters with it works). > Then it would seem that it is either my code or FXRuby that is broken, here is a minimal example that only displays the C:\ drive (and I have drives up till I:\) #################################### #!/usr/bin/env ruby require 'fox' include Fox class MainWindow < FXMainWindow def initialize(app) # Invoke base class initialize first super(app, 'FXDirList Test case', nil, nil, DECOR_ALL, 100, 100, 800, 600) contents = FXHorizontalFrame.new(self, LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH) dirlist = FXDirList.new(contents, 0, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT) # All of these result in just C:\ being displayed, closed, and when one navigates # it is indeed the C:\ drive. D:\music exists. dirlist.directory = 'd:/' #dirlist.directory = 'd:' #dirlist.directory = 'd:\\' #dirlist.directory = 'd:/music' #dirlist.directory = 'd:\\music' end def create super show(PLACEMENT_SCREEN) end end application = FXApp.new mainWindow = MainWindow.new(application) application.create application.run ########################## On my machine, all of those combinations display an unexpanded C:\ drive, and when I start to navigate the tree, it is indeed C:\. FXRuby does not seem to have a setDirectory method for that widget, and that would probably be a bit unrubyish, but I did try with several such calls too, with no result. Anybody see anything immediately wrong with the above code, so I can correct it? :) I would rather have the "all drives" widget, but getting this to work is definitely good enough. (Btw, any unrelated code errors is also up for critisism, I'm here to learn :) Still Windows XP, ruby 1.8.0 and FXRuby 1.0.22. Thanks, -- Kristoffer -- Sent using: Mozilla Thunderbird 0.2 (20030901) http://www.mozilla.org/projects/thunderbird/ |
From: Lyle J. <jl...@cf...> - 2003-09-15 14:44:44
|
Kristoffer Lund=E9n wrote: > Then it would seem that it is either my code or FXRuby that is broken,=20 > here is a minimal example that only displays the C:\ drive (and I have=20 > drives up till I:\) <snip> > On my machine, all of those combinations display an unexpanded C:\=20 > drive, and when I start to navigate the tree, it is indeed C:\. Jeroen: Kristoffer is absolutely correct, there is a bug in the=20 FXDirList widget, at least for the fox-1.0.x series. Have not checked it=20 on fox-1.1.x. The problem is that if you call FXDirList::setDirectory()=20 before calling create() on the directory list widget, the call to=20 scanRootDir() in FXDirList::create() blows away the previous tree structu= re. Kristoffer: Based on that, the workaround for your program is to first=20 save a reference to the directory list in an instance variable after=20 constructing it, i.e. @dirlist =3D FXDirList.new(...) and then set the directory in your MainWindow#create method, *after*=20 calling the base class version of create(), i.e. class MainWindow def create # Do base class create first super # Now set the desired directory @dirlist.directory =3D 'D:\\music' # and show the main window show(PLACEMENT_SCREEN) end end Hope this helps, Lyle |
From: jeroen <je...@fo...> - 2003-09-16 12:50:17
|
On Monday 15 September 2003 09:58 am, you wrote: > Kristoffer Lund=E9n wrote: > > Then it would seem that it is either my code or FXRuby that is broken= , > > here is a minimal example that only displays the C:\ drive (and I hav= e > > drives up till I:\) > > <snip> > > > On my machine, all of those combinations display an unexpanded C:\ > > drive, and when I start to navigate the tree, it is indeed C:\. > > Jeroen: Kristoffer is absolutely correct, there is a bug in the > FXDirList widget, at least for the fox-1.0.x series. Have not checked i= t > on fox-1.1.x. The problem is that if you call FXDirList::setDirectory() > before calling create() on the directory list widget, the call to > scanRootDir() in FXDirList::create() blows away the previous tree > structure. > > Kristoffer: Based on that, the workaround for your program is to first > save a reference to the directory list in an instance variable after > constructing it, i.e. > > @dirlist =3D FXDirList.new(...) > > and then set the directory in your MainWindow#create method, *after* > calling the base class version of create(), i.e. > > class MainWindow > def create > # Do base class create first > super > > # Now set the desired directory > @dirlist.directory =3D 'D:\\music' > > # and show the main window > show(PLACEMENT_SCREEN) > end > end > > Hope this helps, > > Lyle I see. In my opinion, there may be another workaround which is perhaps simpler: call setDirectory() TWICE. What happens is the scanRootDir() switches to the current drive. However, setDirectory SETS the current drive, except for the first time, when the toplevel FXDirItem doesn't exist yet. FOX 1.1's FXDirList works much differently internally, so I don't think=20 it has the same problem. - Jeroen --=20 +------------------------------------------------------------------------= ----+ | Copyright (C) 20:40 09/15/2003 Jeroen van der Zijp. All Rights Reserv= ed. | +------------------------------------------------------------------------= ----+ |