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. | +------------------------------------------------------------------------= ----+ |