Page 1 of 1

PostPosted: Sun Nov 26, 2006 8:45 pm
by RWB
Hi friends.Is there an easy way, to list the internal files, in a listbox?

ex: I have a button and a listbox.
When I push the button the internal files shall show up in the listbox.

I saw the vfs sample and it's great but, it's to advanced for my app.

Also.I just want the list to show my files.
Should I save my files like ,myfile.myf , to get , *.myf, files in the listbox?


PostPosted: Tue Nov 28, 2006 8:04 pm
by FrankG
Yes - the internal files are much easier to list than VFS ones. Take a look at the sample code for DatabaseMgr objects in the help info. You can loop and get files using the dbenum method. dbenum returns the filename so you'd have to test it against a mask if you want to limit the list by name.


PostPosted: Wed Nov 29, 2006 3:29 pm
by RWB
Thanks Frank,for the response but,
I struggle with this :(.
denum!,I read about this and tried some code but the lack of exampel in the manual is so frustrated.I can't get it to work!

Can You show me some code,please?

Best regards :(


PostPosted: Wed Nov 29, 2006 3:41 pm
by sangahm
Did you see this in the helpfiles?

From: Contents > Library Reference > VFS > Directory object > enumerate

void listFiles(Volume vol) {
string name;
int attribs;
Directory dir;
bool first = true;

if (vol.openDir("/", dir) == 0) { // open the root directory
while (dir.enumerate(first, &name, &attribs)) {
first = false;
if ((attribs & vfsAttrDirectory) == 0) { // don't list directories

PostPosted: Wed Nov 29, 2006 3:53 pm
by FrankG
...and actually there are some code samples dealing with dbenum in this forum. Do a search on dbenum and see which code helps.


PostPosted: Thu Nov 30, 2006 8:33 pm
by RWB
Hi friends and thanks for the replies.

Yes I saw the code in the helpfiles and I paste it in to my main.oc but,
How do I call the function with my listbox?
I tried listFiles();//didn't work!

mylistbox.setitemslist(listFiles(Volume vol));//didn't work either!

I have a long way to go yet!

Please help :(


PostPosted: Wed Dec 27, 2006 3:18 pm
by RWB
I solved my filebox issue like this.
A ulist with "last files used" instead.
so I can choose a file.
and it works great. :D