Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Listview listitems remove memory leak?
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00979013
Message ID:
00979153
Views:
10
This has happened before and this is what I did.

I moved the place the method checked for an existing node object from a VFP PROCEDURE to a "spare" method in the ocx listview. It matters not what form the listview is on or what method used.

Not wanting to spagetti the itemclick method that pushed a bunch of refresh procedures, the ItemCheck method was substituted. It works great.

So remember kiddies, when your VFP procedures have a problems recognozing childrenof your activeX controls - try moving the "witnessing" inside an activeX controls method.
* Old way
procedure SelectANode(myform,cKey)
If A_Condition_Exists and type("myform.myListview.ListItems(key).key")==[C]
   * This failed subsequent to node "Remove"
   myform.myListview.ListItems(key).Selected = .t.
endif 
enproc 

* New way
If A_Condition_Exists(myform,cKey)
   * Works all time
   * Used a selected object on a parent for instead of key
   myform.myListview.ItemCheck(myOtherform.myOtherListview.ListItems(key))
endif 
enproc 

procedure myform.myListView.ItemCheck(loItem)
IF TYPE('this.ListItems(loItem.key).key')==[C]
   WITH this
   .ListItems(loItem.key).Selected=.t.
   ENDWITH 
ENDIF 
ENDPROC
>My project has a listview control. Another [parent] form points to an active "record".
>
>The listview form has a spinner that changes month/year. When the month/year is the same as the active record in the parent form, a method highlites the row that matches the active parent form record.
>
>I can add nodes to the listview [child] form and flip through month year (on the listview form) and the row will highlite when the month year matches the "active" record in the parent.
>
>However, should rows be "Removed" from the Listview - the month/year action will not highlite the listview rows (nodes). The nodes are there but TYPE does not recognize the as an object - thus the hightlite is skipped.
>
>The desired behavior can be "reset" by clicking a node/row on the listview.
>
>I have googled a bit and even substituted bogus list node keys for the existing node keys before they are removed. I have tried refresh. Inserted "Object" too! Setfocus!
>
>Here is the test that fails (it works on all other situations):
>If type("myform.myListview.ListItems(key).key")==[C] (key or text can be used)
>
>Thank you
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform