Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TStringList Columns!

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
50 points for this one...

Alright, so I've got files and directories rolling in and getting mixed all together. The simple solution was to check and see which items were using zero memory. The ones that did, I wanted to put in their own TStringList. It's pretty much a filter. files go in one stringlist and directories go in the other based on 0 memory usage. Once the proggie filters through the lists, I insert the directory StringList and then the files StrLst list into a ListView.

The problem is that both types have modified dates and attributes, which I wanted to include in the list. I, however, can't for my life get substrings for the attributes. (Columns, whatever...) Isn't there any property or anything that I can put in multiple columns of data? And for the love of God! please don't tell me to make an invisible ListView or ListBox!

Cyprus
 
There is an structure called WIN32_FIND_DATA and a function called GetFileAttributes. These are MS APIs so you may have to look at your MS help files under Win32 Developers Reference. I've used the structure like this:
Code:
WIN32_FIND_DATA myFileAtt;
.
.
.
// Your code to get the files
.
.
.
if (myFileAtt.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
{
    // You have a directory, do something with it
}

James P. Cottingham

There's no place like 127.0.0.1.
There's no place like 127.0.0.1.
 
The problem isn't anything about file handling. The files are remote, in any case. My problem is simply needing substrings in a TStringList. Everything else works.

Cyprus
 
"Oh, I see," said the blind man as he picked up his hammer and saw.
Sometimes I dense. ;-)

So you have a TStringGrid set up with some rows and columns. You will need to use the string grid's cell properties. Something like:
Code:
MyStringGrid->Cells[0][0] = "*"; // Puts a * in upper left-hand corner
MyStringGrid->Cells[1][0] = "A"; // Puts A below the *
MyStringGrid->Cells[0][1] = "Que"; // Puts Que next to the *
The above code should produce a string grid like:
[tt]* Que
A[/tt]

Is this closer to what you need?

James P. Cottingham

There's no place like 127.0.0.1.
There's no place like 127.0.0.1.
 
:) It's not a component at all, simply a TStringList *MyStringList... and what I needed was to put something like:

NAME___DATE___SOMETHING
NAME2__DATE2__SOMETHING2

each of those things in their own column... All i was really looking for is either if it was possible in a TStringList or if there was some other object I could do it in... screw it, I'll just pull a
TListView *DirectoryView = new TListView(this);
and get it over with. :'(
Unless anyone else has some better suggestions

Cyprus
 
Do you want a grid that can be stored in a file?

You said that your problem is needing substrings in a TStringList.
like this?

StringList->Strings[index]; // it returns an AnsiString
//where index is zero based.



--- LastCyborg ---
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top