Hi,
I have a listview:
'Holiday list view box
CONTROL f3,@LISTVIEW,"",600,35,180,150,@VSCROLL|@LVSSORTASCENDING|@CTLISTNOTIFY,747
CONTROLCMD f3,747,@LVINSERTCOLUMN,0,"Holiday dates"
CONTROLCMD f3,747,@LVINSERTCOLUMN,1,"days"
CONTROLCMD f3, 747, @LVSETCOLWIDTH, 0, 120
CONTROLCMD f3, 747, @LVSETCOLWIDTH, 1, 50
Where f3 is the window, 747 is the listview.
How can I get both columns to match up?
e.g. of the data:
Holiday date Days
05-10-2013 5
12-08-2013 3
08-08-2013 2
If i use the @LVSSORTASCENDING to sort the holiday date, the "Days" column does not correspond to the correct date.
e.g.
08-08-2013 5
12-08-2013 3
05-10-2013 2
Is there a way I can do this?
if there is only one column, then @LVSSORTASCENDING works fine for the dates.
Thanks,
Andy.
The trick is in how you go about adding entries to the Listview.
The following assumes each date is unique
CONTROL f3,@LISTVIEW,"",600,35,180,150,@VSCROLL|@LVSSORTASCENDING|@CTLISTNOTIFY,747
CONTROLCMD f3,747,@LVINSERTCOLUMN,0,"Holiday dates"
CONTROLCMD f3,747,@LVINSERTCOLUMN,1,"days"
CONTROLCMD f3, 747, @LVSETCOLWIDTH, 0, 120
CONTROLCMD f3, 747, @LVSETCOLWIDTH, 1, 50
string indate,indays
indate ="05-10-2013"
indays="5"
int pos=0,position
'this will be a loop
CONTROLCMD f3,747,@LVINSERTITEM,pos,indate
position = CONTROLCMD( f3,747, @LVFINDITEM, indate)
CONTROLCMD f3,747,@LVSETTEXT,position,1,indays
pos++ 'this is so we are always adding to the end of the list initially
'grab the next data and go through the loop again
'end of the loop
You should be able to make it work from this
Thanks Larry,
Yes I will try that.
I came up with an idea and it works - see attached code.
it uses 2 listviews - one on screen and one "hidden".
The later is sorted and the populates the first listbox (visable).
Thanks,
Andy.
:)