StrataFrame Forum

ListView PerformEditActionOnDoubleClick not working...

http://forum.strataframe.net/Topic20905.aspx

By Greg McGuffey - 11/26/2008

I recently was working with a parent-child-grandchild situation using listviews and child form dialogs. On the child form dialog for the child, the edit on double click doesn't work with the BO that was translated from the parent....The easiest way to see this error is to just modify the Child Form Dialog sample provided with SF.



1. On the CustomerNotesItems form, simply modify the listview by setting the BO to the CustomerNotes BO on the form.

2. Run it, select a customer, view notes.

3. Double click on a note...boom



Manually calling edit on the CustomerNotes works fine, as is done when clicking the Edit button. Any ideas what's happening?
By Trent L. Taylor - 12/1/2008

Using the ChildFormDialog sample, here is how to fix the problem:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    MyBase.OnLoad(e)

    lvNotes.BusinessObject = Me.CustomerNotes
End Sub

Notice that in the OnLoad AFTER the base logic has been called, I am resetting the object instance on the list to the one on the form.  Technically this is what you had done within the designer...right?  Well, yes and no.  StrataFrame "translates" the business objects using reflection in the Load.  However, we do not reflect over every object on the form so see if there is another instance of that BO used someplace else.  This could really slow things down.  So by resetting the object instance after the base logic has done its thing, the translated instance will then be used since the form level BO has been translated to use the BO from the calling form.

By Edhy Rijo - 12/1/2008

Hi Trent,

I have one ChildForm in which I had to do the same, don't quite remember the reasons now, but does this mean that it should be a common practice when using the ListView with ChildForm features to confirm the ListView?

If so I will add that to my own ChildForm template Wink

By Trent L. Taylor - 12/1/2008

Not necessarily.  The only time this would happen is on a child form called through a BO translation class (i.e. ChildFormDialog, etc).  If the records are showing up correctly, I would leave this alone. 
By Greg McGuffey - 12/1/2008

That makes sense. Thanks Trent!