1. How do you populate a ListView?
- Posted by ronaustin at alltel.net Oct 17, 2003
- 460 views
--------------Boundary-00=_NVYV8WA1VA4000000000 charset="iso-8859-1" I am trying to display the contents of a database using listview. I am=0D looping through the database to populate the list box using this little=0D snippette: =0D =0D count =3D addLVItem(myLV,1,db_key) =0D count =3D addLVItem(myLV,2,db_data) =0D Instead of getting the key in column1 and the data in column2 it is putti= ng=0D the the first key in column one with it's data under it and then it puts = the=0D second key in the first column with it's data under that. Nothing is goin= g=0D into column 2. What am I doing wrong?=20 --------------Boundary-00=_NVYV8WA1VA4000000000 Content-Type: Text/HTML; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <HTML><HEAD> <META content=3D"IncrediMail 1.0" name=3DGENERATOR> <!--IncrdiXMLRemarkStart> <IncrdiX-Info> <X-FID>FLAVOR00-NONE-0000-0000-000000000000</X-FID> <X-FVER></X-FVER> <X-CNT>;</X-CNT> </IncrdiX-Info> <IncrdiXMLRemarkEnd--> </HEAD> <BODY style=3D"BACKGROUND-POSITION: 0px 0px; FONT-SIZE: 12pt; MARGIN: 5px= 10px 10px; FONT-FAMILY: Arial" bgColor=3D#ffffff background=3D"" scroll=3D= yes ORGYPOS=3D"0" X-FVER=3D"3.0"> <TABLE id=3DINCREDIMAINTABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100= %" border=3D0> <TBODY> <TR> <TD id=3DINCREDITEXTREGION style=3D"FONT-SIZE: 12pt; CURSOR: auto; FONT-F= AMILY: Arial" width=3D"100%">I am trying to display the contents of a dat= abase using listview. I am<BR>looping through the database to populate th= e list box using this little<BR>snippette: <BR><BR>count =3D addLVItem(my= LV,1,db_key) <BR>count =3D addLVItem(myLV,2,db_data) <BR>Instead of getti= ng the key in column1 and the data in column2 it is putting<BR>the the fi= rst key in column one with it's data under it and then it puts the<BR>sec= ond key in the first column with it's data under that. Nothing is going<B= R>into column 2. What am I doing wrong? <BR><BR><BR></TD></TR> <TR> <TD id=3DINCREDIFOOTER width=3D"100%"> <TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%"> <TBODY> <TR> <TD width=3D"100%"></TD> <TD id=3DINCREDISOUND vAlign=3Dbottom align=3Dmiddle></TD> <TD id=3DINCREDIANIM vAlign=3Dbottom align=3Dmiddle></TD></TR></TBODY></T= --------------Boundary-00=_NVYV8WA1VA4000000000--
2. Re: How do you populate a ListView?
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 18, 2003
- 434 views
----- Original Message ----- >From: ronaustin at alltel.net >Subject: How do you populate a ListView? > > > >I am trying to display the contents of a database using listview. I am >looping through the database to populate the list box using this little >snippette: > >count = addLVItem(myLV,1,db_key) >count = addLVItem(myLV,2,db_data) >Instead of getting the key in column1 and the data in column2 it is putting >the the first key in column one with it's data under it and then it puts the >second key in the first column with it's data under that. Nothing is going >into column 2. What am I doing wrong? I really should rename addLVItem() to something like addLVRow() because that's what it does. It adds an entire row of listview column data items in one go. You need to give it all the column values as a sequence in the last parameter. The second parameter is meant to be a handle to an icon. So try this instead... count = addLVItem(myLV, 0, {db_key, db_data} ) This assumes that you have created or set up the listview with the correct number of columns. -- Derek
3. Re: How do you populate a ListView?
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 20, 2003
- 468 views
----- Original Message ----- >From: ronaustin at alltel.net >Subject: RE: How do you populate a ListView? > > >> >>-------Original Message------- >> >>From: EUforum at topica.com >>Date: Friday, October 17, 2003 4:30:21 AM >>To: EUforum >>Subject: RE: How do you populate a ListView? >> >> >>should be >>count = addLVItem(myLV, 0, {db_key,db_data}) >>You can replace the 0 with the id for an icon returned >>whith addIcon command > >Thanks. That's better. It is displaying two columns, except > the columns are not the right width and there is a third >column with nothing in it. I think I can set the column width > with LVCOLUMN, but I just can't figure it out, and I don't >now how to get rid of the 3rd column. I can't find an example. Well the first thing is to work out how you got 3 columns in the first place. Can we see your create() call for it? Are you using insertLVColumn() anywhere? If you only need two columns your create() call could look like this ... myLV = create(ListView, {"Key", "Data"}, ... ,LVS_REPORT) And if you know how wide you want them at the outset you could create it that way too... myLV = create(ListView, {{"Key",100,0}, {"Data",400,0}}, ... ,LVS_REPORT) will create two columns, 100 and 400 pixels wide respectively. -- Derek