ThumbViewer.CompareThumbs

From Jeremie Leroy - XOJO Controls Wiki
Revision as of 16:25, 7 August 2015 by Admin (Talk | contribs) (3 revisions imported)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event
ThumbViewer.CompareThumbs ( Thumb1 As ThumbNail, Thumb2 As ThumbNail, ByRef Result As Integer ) As Boolean


The CompareRows event is used for sorting ThumbNails in a manner that is not provided by the default mechanism. The result of the comparison is returned in the last parameter, Result, which is declared Byref. The default mechanism sorts Thumb names lexicographically. If you implement the event, it gets called during a ThumbViewer sort.

Parameters:

  • Thumb1: First thumb being compared.
  • Thumb2: Second thumb being compared.

Set Result to:

  • 0: If Thumb1 and Thumb2 are equal.
  • -1: Contents of Thumb1 < Contents of Thumb2.
  • 1: Contents of Thumb1 > Contents of Thumb2.

Return True if the returned Result parameter is accurate for sorting.

Return False if you want the ThumbViewer to use the default lexicographic sorting of the Thumbs.

Example

The following code in the CompareThumbs event will compare the ThumbNails according to the value of their respective Tag property.

  If Thumb1.Tag.DoubleValue > Thumb2.Tag.DoubleValue then
    Result = 1
  elseif Thumb1.Tag.DoubleValue < Thumb2.Tag.DoubleValue then
    Result = -1
  else
    Result = 0
  End If
  Return True