mIRC Home    About    Download    Register    News    Help

Print Thread
#107436 10/01/05 08:37 AM
Joined: Feb 2003
Posts: 67
N
Naz Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Feb 2003
Posts: 67
I'm using mdx with listview and have code in place to sort by column when I click a header using the filter command. This works fine when no line has been selected.

When I do select a line, the selected line does not get sorted properly when a header is clicked. It either ends up at the top or bottom of the list.

I'm guessing that the filter command is picking up the "0 +fs 0 0 0 infohere..." instead of just the actual cell content. If so, is there a way around this? If not, what am I doing wrong.

Code:
on *:dialog:dcci:sclick:2: {
  did -i dcci 2 1 page headerevent
  if ($gettok($did(2,1),1,32) == headerclick) {
    if (%rt.c != $gettok($did(2,1),3,32)) { set %rt.s 1 }
    set %rt.c $gettok($did(2,1),3,32)
    if (%rt.s == 1) {
      set %rt.s 2
      filter -ciorte 2- $+ $did(dcci,2).lines %rt.c 9 dcci 2 dcci 2
    }
    else {
      set %rt.s 1
      filter -ciort 2- $+ $did(dcci,2).lines %rt.c 9 dcci 2 dcci 2
    }
  }
}
  


Those who live by the sword get shot by those who don't.
#107437 10/01/05 01:01 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Yes, you're right. It's the "+fs" of the selected line that fools /filter.

If the listview text never contains spaces, you can tell /filter to use 32 (space) as a separator instead of 9 (tab), and calculate the column using "N * 4 + 2" where N is the position of the clicked header (click for an example). If this is not the case, I'm afraid /filter is not going to be an option (unless somebody has a better suggestion—maybe a way to get rid of both "f" and "s" prior to the call to /filter).

#107438 10/01/05 09:37 PM
Joined: Feb 2003
Posts: 67
N
Naz Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Feb 2003
Posts: 67
Ok thx. I might experiment with replacing spaces with $chr(160) before inputing to the list and use 32 as the column seperator as u suggested.


Those who live by the sword get shot by those who don't.

Link Copied to Clipboard