StrataFrame Forum

Finding The Parent

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

By Geoff Hirst - 3/31/2009

Hi Guys,

I am using the listview, in its full automated glory. What I have is a childform that has 3 buttons on it, that are OK/Add,OK and Cancel. OK and Cancel are easy enough to deal with, but the OK/Add button keeps the child form open so that the user can add another item and for the parent form to update and show the line that was added. The idea is to just reduce mouseclicks.

Now, I had previously done this using the parentform capability, but when using the childformdialog this seems to be empty.

What is best way of finding out the parent form that a childform was launched from is this held anywhere?

Also, how do you pass in parameters to a childform when using the automated listview? I can't see this being done in strataflix, but I might have missed it. Indeed, this could resolve my first problem.

thanks

Geoff.

By Edhy Rijo - 3/31/2009

Hi Geoff,

I don't quite understand what is the problem here. I know your OK/Add button will add another record to the childBO and let the childform opened so this new record can be edited, right? if so what is the problem you are facing?

Also it would be helpful if you post the code in your OK/Add button.



About the parameter, I don't thing it is supported, but if you need to access the parent BO, simply add it to the childform and in the parent form's childformdialog add a translation to the parent BO as you did with the child BO.
By Geoff Hirst - 3/31/2009

Sorry Edhy,

I may not have explained this very well.

What I want to see is that if my user clicks OK/Add, for the listview that is on the parent form 'behind' my childform, updating with the record I just added.

If I can get a reference in the childform of the parentform, I can call a simple listview requery, but I can't seem to do this. If I could pass through parameters, I could just pass thru a reference to the form, that would enable me to do the above.

I have tried to accomplish this using different dialogresults, such as ignore or none. dialogresult.Ignore makes the child form close, which I don't want, and   dialogresult.none doesn't update the listview on the parent.

thanks

Geoff

By Greg McGuffey - 3/31/2009

Ah, I see. Because the ListView itself handles opening the ChildFormDialog, you don't have an easy way to requery the list (I think that is what's going on).



I think the first thing I'd try is to just handle an event on the BO, like the AfterSave event. Since you are likely passing this through to the ChildFormDialog, you could just requery whenever the child BO is saved.
By Trent L. Taylor - 3/31/2009

I have actually wanted to do this before and I jsut haven't done it....primarily because you can get around it pretty easy.  I just created a shared (static) property that was exposed on the child form which is a reference to the parent form.

Private Shared _MyParentForm As Form
Public Shared Property MyParentForm As Form
    Get
        Return _MyParentForm
    End Get
    Set
        _MyParentForm = value
    End Set
End Property
By Geoff Hirst - 4/1/2009

Hi Trent,

THanks for this.

If you are using the Listview automation, how do you get to be able to access this property? The form is wrapped up in the ChildFormDialog object, which doesn't have any events. The Listview has the BeforeChildFormExecuted, but again I can't find anyway to access the actual form.

thanks in advance

Geoff.

By Geoff Hirst - 4/1/2009

Trent,

Sorry, missed the shared (most important bit).

best

Geoff.

By Trent L. Taylor - 4/1/2009

No problem Smile