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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TMS AdvStringGrid

Status
Not open for further replies.

MerryMadDad

Programmer
Dec 11, 2001
47
GB
Is there anyone out there who uses TMS software components, namely AdvStringGrid ?
I have a problem with sorting.

Grid layout

group name salary (Column headers)
.
.possible blank rows
.
Group1 Bob 10,000
Fred 7,000
Jim 12,000
.
.
. blank rows
.
.
.
Group2 Jane 10,000
Jill 7,000
Julie 12,000
.
.possible blank rows
.

I want to be able to sort on one column only (Salary) with the smallest salary first, but I want to keep all the rows within their group i.e. male / female and I would like the Group number to remain at the top row in its group. I would also like to keep the blank rows where ever they appear, as other data may be inserted in the blank rows for in each group later. At present Fred and Jill are sorted to the first rows in the whole grid, the blank spaces disapearing :(
Can anyone help ?

Thanks

Robert
 
So, if I understand correctly, you want to sort by group then by salary?

I use TADVStringgrid quite a lot but unsure if you can sort on multiple columns at once.

If you can't do a multi column sort in one go, you can do the sorting in a query if it's retrieved from a database and use the TDBAdvStringGrid.

The blank rows may be a problem.

How do you store and read this data for the grid?

lou


 
Actually, you should be able to do this by using the OnCustomCompare event.

 
Hi Lou,

Thanks for the reply

I store the data for this grid in a text file. I do not want to sort the groups, I want them to remain where they are in the grid, but I do want to sort on the salary within a group without affecting the display or position in the grid of the sorted group or any other group except the sorted rows of course (see initial post).
You can sort on multiple columns, but I don't think I need that. Been to the TMS web site and also e-mailed them for help, but they pointed me to the FAQ section of their web site - which did not help. I don't understand how to use the custom sort for AdvStringGrid. I have version 1.9x which I got free with PCPLUS and use it in Delphi 4. any bits of smaple code would be much appreciated.

Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top