/sortheader

By Relinsquish on Mar 14, 2005

This command sorts items in ascending and descending order based on item text for dialogs with MDX.dll formatted listviews without the nosortheader style.

; Name: /sortheader
; Date: March 14, 2005
; Description: This command sorts items in ascending and descending order based on item text for dialogs with MDX.dll formatted listviews without the nosortheader style.
;
; By: Relinsquish
; IRC: irc.undernet.org @ #mIRC.net
; E-mail: Relinsquish@mirc.net
;
; Syntax: /sortheader name id column
;
; Name is the dialog name.
; ID is the dialog id.
; Column is the dialog column to be sorted.
;
; Example:
;
; /sortheader acronyms 2 3
; Sorts the third column for the dialog acronyms in id 2
;
; Note: The alias will toggle between ascending and descending sort, ascending being the first sort.

alias sortheader {
  if (!$isid) {
    if (!$3) {
      echo -ac $+ $iif($active == Status Window,e) info * /sortheader: insufficient parameters
    }
    elseif (!$dialog($1)) || ($3 !isnum 1-) {
      echo -ac $+ $iif($active == Status Window,e) info * /sortheader: invalid parameters
    }
    elseif ($hget(sortheader. $+ $1,$+($2,.,$3))) {
      filter -iorcte 2- $+ $did($1,$2).lines $3 9 $1 $2 $1 $2
      hdel sortheader. $+ $1 $+($2,.,$3)
    }
    else {
      filter -iorct 2- $+ $did($1,$2).lines $3 9 $1 $2 $1 $2
      hadd -m sortheader. $+ $1 $+($2,.,$3) 1
    }
  }
}
on *:DIALOG:*:*:*: {
  if ($devent == sclick) && ($did) {
    tokenize 32 $did($did,1)
    if ($1-2 == headerclick headerEvent) && ($3 isnum) {
      sortheader $dname $did $3
    }
  }
  if ($devent == close) && ($hget(sortheader. $+ $dname)) {
    hfree $v1
  }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.