Article Preview
Buy Now
| Print: | |
| PDF: |
Feature
Beginner Q?A
Answers for Beginner's Questions
Issue: 4.4 (March/April 2006)
Author: Christian Schmitz, cSchmitz-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 11,848
Starting Page Number: 24
RBD Number: 4410
Resource File(s): None
Related Link(s): None
Known Limitations: None
Excerpt of article text...
I recently had contact with some beginners and helped them with a few tasks in REALbasic.
Do a file list
If you want to have a listbox with a folderitem associated with each row, e.g., a file list, you can do that in a bad way.
The bad way is to have a column (invisible) with the absolute paths of the files and folders. While it is quite easy to do and beginners like to do it, you will run into trouble. First, the file may move while you have the absolute path in the listbox. Second, a path may not be unique on all file systems. And third, we have a much nicer solution. The good way is to simply assign the folderitem used to create the listbox row to the celltag property like this:
dim f as folderitem
f=Desktopfolder // some target file or folder
listbox1.addrow f.name
listbox1.cell(listbox1.lastindex,0)=f
This way you store a reference to the folderitem itself in the row. If you remove the row from the listbox your reference is gone. Of course you can store some reference to a data class there if you need to keep more information connected to the row than just the folderitem.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|







