Re: LoadLVInfo & Icons/XPM's - att Derek
- Posted by Derek Parnell <ddparnell at bigpond.com> May 23, 2003
- 360 views
Tony, it seems that ListViews will only accept ICON files and not bitmaps. Change the loadBitmapFromFile() calls to use real .ico files and it works. ---------------- cheers, Derek Parnell ----- Original Message ----- From: "Tony Steward" <tsteward at dodo.com.au> To: "EUforum" <EUforum at topica.com> Subject: RE: LoadLVInfo & Icons/XPM's - att Derek > > Hi Derek, > This doesn't seem to work. > I took your eample and came up with the attached code but it only fills > column 1 > > Thanks > Tony > > > -----Original Message----- > > From: Derek Parnell [mailto:ddparnell at bigpond.com] > > Sent: Thursday, 22 May 2003 9:06 PM > > To: EUforum > > Subject: Re: LoadLVInfo & Icons/XPM's - att Derek > > > > > > ----- Original Message ----- > > From: "Tony Steward" <tsteward at dodo.com.au> > > To: "EUforum" <EUforum at topica.com> > > Sent: Thursday, May 22, 2003 6:43 PM > > Subject: RE: LoadLVInfo & Icons/XPM's - att Derek > > > > > > > Hi Derek thanks for your help again, > > > When will we see this next release or is it possible to send me the > new > > > LoadLVInfo routine. (I guess its probably not that simple) > > > > > > > I'm planning the release for this weekend. But here is the updated > > loadLVInfo() and its docs. > > > > > > --/topic ListView control > > --/func loadLVInfo(integer id, sequence pNewData) > > --/desc Used to bulk load data into a list view control > > -- /i id is the ID of the /ListView control /n > > -- /i pNewData is a list of row data and optional image ids. > > -- Each element is either a list of column data or an image id > > -- as returned from /addIcon(). An image id applies to all > > -- the row data that follows until the next image id. > > -- > > --Example: > > --/code > > -- sequence theData > > -- integer iconMale, iconFemale > > -- iconMale = addIcon(loadBitmapFromFile("male.bmp")) > > -- iconFemale = addIcon(loadBitmapFromFile("female.bmp")) > > -- theData = {} > > -- theData &= iconMale > > -- theData = append(theData, {"George", 95.4, "Judo"}) > > -- theData = append(theData, {"Harry", 97.2, "Karate"}) > > -- theData &= iconFemale > > -- theData = append(theData, {"Wendy", 65.1, "Kendo"}) > > -- theData = append(theData, {"Jill", 75.8, "Ice Hockey"}) > > -- theData &= iconMale > > -- theData = append(theData, {"Horatio", 105.1, "Chess"}) > > -- theData = append(theData, {"Felix", 87.0, "Butterflies"}) > > -- loadLVInfo(myLV, theData) > > --/endcode > > global procedure loadLVInfo(atom id, sequence alldata) > > atom hWnd > > atom LV_ITEM > > object data > > integer msg > > integer lImageIdx > > > > hWnd = getHandle(id) > > > > VOID = w32Func( xSendMessage, {hWnd, LVM_DELETEALLITEMS, 0, 0}) > > LV_ITEM = acquire_mem(0, SIZEOF_LVITEM ) > > lImageIdx = -1 > > for i = 1 to length(alldata) do > > data = alldata[i] > > if sequence( data ) then > > store( LV_ITEM, LVITEM_iItem, i-1) > > store( LV_ITEM, LVITEM_lParam, i ) > > store( LV_ITEM, LVITEM_iImage, lImageIdx) > > for j = 1 to length(data) do > > store( LV_ITEM, LVITEM_iSubItem, j-1 ) > > if not sequence(data[j]) then > > data[j] = sprintf("%g", data[j]) > > end if > > store( LV_ITEM, LVITEM_pszText, data[j] ) > > store( LV_ITEM, LVITEM_cchTextMax, length(data[j]) ) > > if j = 1 then > > msg = LVM_INSERTITEM > > store( LV_ITEM, LVITEM_mask, > > clib:or_all({LVIF_TEXT,LVIF_IMAGE,LVIF_PARAM}) ) > > else > > msg = LVM_SETITEM > > store( LV_ITEM, LVITEM_mask, LVIF_TEXT ) > > end if > > VOID = w32Func( xSendMessage, { hWnd, msg, j-1, > LV_ITEM } > > ) > > end for > > else > > lImageIdx = data-1 > > end if > > end for <snip> > >