IonicWind Software

IWBasic => GUI Central => Topic started by: Brian on May 01, 2013, 02:02:02 PM

Title: Copy a whole line in a Listview
Post by: Brian on May 01, 2013, 02:02:02 PM
Hi,

I need to  copy a whole line (all columns) from a listview, and write it intact to a file

I'm OK with the file writing, but is there a way to copy the whole line of a listview?

Brian
Title: Re: Copy a whole line in a Listview
Post by: billhsln on May 01, 2013, 02:14:21 PM
CASE @NMCLICK
lvi=*<NMLISTVIEW>@LPARAM.iItem
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,0,RecNo$)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,1,baseset)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,2,cardset)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,3,hp)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,4,rarity)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,5,ctype)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,6,abbrev)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,7,setno)
CONTROLCMD(d1,D1_L1,@LVGETTEXT,lvi,8,fullname)
orec = RecNo$ + baseset + cardset + hp + rarity + ctype + abbrev + setno + fullname
Write (ofile,orec)


If I were going to pull the entire listview and sent it to a file, I would do the above or something close to it.

Bill
Title: Re: Copy a whole line in a Listview
Post by: LarryMc on May 01, 2013, 02:28:49 PM
The above example doesn't take into account a delimiter separating the field data

I would put it in a subroutine like this(it does the same thing and adds a delimiter.)

CASE @NMCLICK
   lvi=*<NMLISTVIEW>@LPARAM.iItem
   Write (ofile,get_list_line(d1,D1_L1, lvi, 9))



sub get_list_line(window win, int id, int ln, int cols),string
   string text$,temp
   int x

   for x=0 to cols-2
      CONTROLCMD(win, id, @LVGETTEXT, ln, x, temp)
      text$ += temp+","
   next x
   CONTROLCMD(win, id, @LVGETTEXT, ln, x, temp)
   text$ += temp
   return text$
endsub

I don't know what the max width of data in each colum is; so you may need to adjust and use ISTRINGS
Title: Re: Copy a whole line in a Listview
Post by: Brian on May 01, 2013, 03:52:22 PM
Thanks, Chaps!

The length of a whole line is never more than 260 chars. I can work with some of that code easy enough

I just want it to loop through the whole listview, line by line, and write the data out. Thing is, depending on
what a particular column contains, the line either goes to File A or to File B. I'm not bothered about grabbing
the data with a mouse click

Bedtime here now!

Brian