eric 0

eric 0

  • NA
  • 5
  • 0

Changing display order in a list

Dec 13 2003 5:44 PM
I'm sure this is an easy feat, but I'm having a dickens of a time figuring it out and I can't seem to find a decent example. I am using ComponentOne components to display data, but that really shoudn't matter. My application uses a number of tables that will populate pull-down combo boxes. I have three fields for the tables: iID - auto incrementing unique key cDesc - the Description or text that is displayed iOrder - the order to display them in. In my maintenance form, I have a dbgrid control that is linked the data table. Next to it are two button controls, one up arrow and one down arrow. For now, all three columns are displayed, but eventually I want only the description to be displayed. When a user clicks an up arrow, I want the current row in the dbgrid to move up one line. My logic is to number all the items automatically (iOrder) by two starting with 2 for the first one. When the user clicks up arrow, I subtract three from the iOrder of the current row, and then walk through the entire list, renumbering them by twos as I go along. Here's the rub ... how do I get the list to dynamically sort when I make that first change of subtracting three from the order. Should I be using an array instead, then updating the table in background? If there is an example application that does this that I could be pointed to, that would be great! Thank you for your time and assistance. Eric