Login
`
Templates, Tools and Utilities
|
||
Add a comment to an Icetips ArticlePlease add your comments to this article.
Please note that you must provide both a name and a valid email address in order
for us to publish your comment. Comments are moderated and are not visible until they have been approved. Spam is never approved!
Back to article list Search Articles Add Comment Printer friendly Direct link Par2: Sorting a listbox on header click 1999-04-13 -- Arnor Baldvinsson In response to a question on lists from queues:
The code you need to sort, should be in the "NewSelection" embed on
the tab sheet:
Case Choice(?CurrentTab)
Of 1
Sort(MyQueue,MyQueue.Field1)
Of 2
Sort(MyQueue,MyQueue.Field2)
Of 3
Sort(MyQueue,MyQueue.Field1)
End
You can also have the listbox change sort order by clicking on the
header with some fairly simple code.
1. Alert the MouseLeft key on the listbox
2. Embed: Window event handling - PreAlertKey:
Cycle
3. Embed: Window event handling - AlertKey:
If ?List1{Proplist:MouseDownRow} = 0 ! Header
Case ?List1{Proplist:MouseDownField}
Of 1
Loc:Field = 1
Do ResortQueue
Of 2
Loc:Field = 2
Do ResortQueue
Of 3
Loc:Field = 3
Do ResortQueue
End
End
4. Embed: Procedure routines:
ResortQueue ROUTINE
Case Loc:Field
Of 1 ! Keyword alphabetical
Case Loc:SortOrder
Of 1
Sort(Glo:ResultQ,+Glo:RQKeyword)
Loc:SortOrder = 2
Of 2
Sort(Glo:ResultQ,-Glo:RQKeyword)
Loc:SortOrder = 1
End
Of 2 ! Word frequency
Case Loc:SortOrder
Of 1
Sort(Glo:ResultQ,+Glo:RQRelatedArticles)
Loc:SortOrder = 2
Of 2
Sort(Glo:ResultQ,-Glo:RQRelatedArticles)
Loc:SortOrder = 1
End
Of 3 ! Word length
Case Loc:SortOrder
Of 1
Sort(Glo:ResultQ,+Glo:RQWordLength)
Loc:SortOrder = 2
Of 2
Sort(Glo:ResultQ,-Glo:RQWordLength)
Loc:SortOrder = 1
End
End
Display
This toggles sort order of 3 fields in the queue when the user clicks
on the listbox header.
Today is November 21, 2024, 7:05 am This article has been viewed 35253 times.
|
|