On May 2, 2006, at 8:35 AM, Jason Toews wrote:

> On May 1, 2006, at 8:23 PM, Jason Toews wrote:

. The existing listingObject in the row is replaced by the updated one.



How is this done? Do you set the existing listingObject to nil? Or keep it and assign the data from the updated one into the existing one?


Hmmm... right now, I'm simply assigning the new listingObject to the .CellTag, without setting the existing contents of the .CellTag to Nil.

Actually, that's something I've often wondered about. What is the preferred way to do this?

Currently, I:

1. Store one "listingObject" in the .CellTag of the first column of each row in the listbox 2. User double-clicks row, which triggers a method of the listbox, in which...
   3. listingObject is retrieved from the .CellTag
   4. Listing Edit window is created
   5. listingObject is sent to new Listing Edit window
   6. Fields in Listing Edit window are populated from listingObject
   7. Listing Edit window is displayed using .ShowModal
8. User modifies fields on ListingEdit window and clicks a Save button
   9. Field values are used to create a new listingObject
10. Newly-created listingObject is saved as a property of the Listing Edit window 11. Listing Edit window Hides itself, which returns us to the original method of the listbox 12. Newly-created listingObject is retrieved from Listing Edit window and placed in the .CellTag of the first column in the double- clicked row, replacing the existing listingObject. 14. Displayed values in the double-clicked row are updated from the new listingObject.
   15. Listing Edit window (already hidden) is finally closed

Looking that over, it seems wacky.  Suggestions for improvement?


Since your app is becoming sluggish and acting strangely as the above is implemented, I suspect you are creating new objects and retaining references to older objects somewhere so that the older ones don't get removed by Rb's memory management system which is based on reference counting. This is especially likely to happen when assigning objects to properties. It's likely that you will have to explicitly set older object references to nil at some point.

Best,

Jack
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to