Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why doesn't my listview get updated?
Message
 
To
24/02/2004 03:49:19
Jenny Karlsson
Megasol Technologies
Uppsala, Sweden
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00880192
Message ID:
00880318
Views:
22
I tried to figure your loops out. I use strings (keys) instead of index numbers for my listviews.
When I add columnheaders:
PROCEDURE PD_AddPDLVHeadings(oLV)
WITH oLV
.COLUMNHEADERS.ADD(,[PROD_CODE],[Product],87,,)   && Header = Product
.COLUMNHEADERS.ADD(,[CALLER_REF],[Reference],87,,) && Header = reference
ENDWITH
ENDPROC
When I add Items:
PROCEDURE PD_AddPDLV_All_Nodes(oLV)
SELECT R6_ProductDescription
SET ORDER TO PROD_CODE   && PROD_CODE
GO top
SCAN
PD_AddPDLV_ONE_Nodes(oLV)
ENDSCAN
GO TOP  
ENDPROC 

PROCEDURE PD_AddPDLV_ONE_Nodes(oLV)
WITH oLV
* Add the first columm [PROD_CODE] = column key
oNodeRow=.listitems.ADD(,prod_code,prod_code,,) && Prod_Code
* Add the second column [CALLER_REF] = column key
oNodeRow.SubItems(.COLUMNHEADERS([CALLER_REF]).SubItemIndex)=caller_ref
oLV.ListItems(prod_code).ListSubitems(oLV.COLUMNHEADERS([CALLER_REF]).SubItemIndex).forecolor=255
ENDWITH 
ENDPROC
As you can see the the items are added by reference to columnheader keys.
I have used index in list view when the description of the list was ad-hoc or unclear

If you download #9840, there is a procedure (BuildxlvRecSet(loRecordSet)) in ADBCONS.PRG that has a similar approach as yours. It works with generic unknown data. You may want to look at that guy.

Test your understanding of how a "node" is to be added to the List through the command window. Create the form. Drop the list view on it, run the form, and then experiment with adding column headers and columns.

Make sure you LV VIEW property is 3!
Does ListView have a REFRESH()?

If your data is known, and you post back with a representation and how you want it to look, I'll give it a try.

>Why doesn't my listview get updated? I have a Active X listview component, where I would like to present to columns NAME and DESCRIPTION from tableXX. Every object seems to be stated correct but neither headers or subitems(DESCRIPTION) is printed out. What am I doing wrong?
>
>

>LOCAL lcAlias, lcAlias2, loHeader, loItem, lcValue, i, j
>
>lcAlias2 = SYS(2015)
>
>IF !EMPTY(lcAlias)
> SELECT idkey, name, description FROM (tableXX) INTO CURSOR (lcAlias2)
> j = 1
>
> THISFORM.clsrcplistview1.ColumnHeaders.CLEAR
>
> FOR j = 1 TO 2
> IF j > THISFORM.clsrcplistview1.ColumnHeaders.COUNT
> loHeader = THISFORM.clsrcplistview1.ColumnHeaders.ADD()
> ELSE
> loHeader = THISFORM.clsrcplistview1.ColumnHeaders(j)
> ENDIF
>
> loHeader.KEY = SYS(2015)
>
> DO CASE
> CASE j = 1
> loHeader.TEXT = 'Name'
> loHeader.WIDTH = 500
> CASE j = 2
> loHeader.TEXT = 'Description'
> loHeader.WIDTH = 500
> ENDCASE
> ENDFOR
>
> THISFORM.clsrcplistview1.REFRESH()
>
> SELECT (lcAlias2)
> SCAN
> i = 1
> FOR i = 1 TO 2
> lcValue = &lcAlias2..idkey + &lcAlias2..name
> IF i = 1
> loItem = THISFORM.clsrcplistview1.ListItems.ADD(, lcValue, &lcAlias2..name)
> ELSE
> loItem.SubItems(i-1) = &lcAlias2..description
> ENDIF
> ENDFOR
> ENDSCAN
>
> THISFORM.clsrcplistview1.REFRESH()
>ENDIF
>
>

>
>Regards,
>Jenny
Imagination is more important than knowledge
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform