On Aug 1, 2006, at 3:02 AM, Chuck Pelto wrote:
On Jul 31, 2006, at 7:34 PM, CV wrote:
I'd suggest loading your array from the Action event handler of a
Timer(mode 1) enabled from HeaderPressed. You can experiment with
the Period, but regardless, the Timer is designed to wait until
other processes are completed, so it should readily capture the sort.
After running some tests, I determined that there was NO WAY I
could capture the change in sorting of columns from ANYTHING inside
of the ListBox, as none of the events allow for letting the 'dust
settle', i.e., all actions completed.
Yes, that was my conclusion as well.
There might be some other functionality that would allow one to
capture that sort of thing AFTER all is 'said and done'. But I'm
not aware of it.
That would be a Timer.
Instead, I realized that I can wait until the end-user decides to
finish sorting data in the ListBox and then double-clicks a row to
see a form view or changes tables, [Note: The ListBox is in a
TabPanel of the window.] THEN I can capture the re-sorted
information in the array and work with it.
Sounds good. An appropriate design change.
The next question [there ALWAYS is one of those] is....
....what's the best way to capture the sequence in which the header
is pressed? I'm thinking of capturing the columns, the sequence in
which they are pressed and whether they end up ascending or descending
Create a new class, say SortData, and give it two properties:
ColumnSorted as integer, SortDirection as string. Add a method called
Constructor with parameters: Column as integer, Direction as integer.
Put this code in the Constructor of SortData:
ColumnSorted = Column
If Direction = 1 then ColumnSortDirection = "ascending"
If Direction = -1 then ColumnSortDirection = "descending"
Add a property to your window or subclassed listbox: SortHistory(-1)
as SortData
In the listbox's HeaderPressed event put this code:
dim sd as new SortData(column, me.ColumnSortDirection(column))
self.SortHistory.Append sd
The array, SortHistory, holds all of the sorts in sequence. You can
add another method(s) to the SortData class to return sorts. Remember
that SortHistory is 0-based, so that the result of the 5th header
pressed is SortHistory(4).
Best,
Jack
This maintains a sequential history of each headerpressed event.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>