By Daniel Essin - 3/9/2006
Here's a question. The tutorials demonstrate dragging BOs onto forms and raise the suggestion that one might open other forms, e.g. a maintenance form, toi work on a record that is the current row in a BO on a search form. But - there is no example that demonstrates your preferred (or envisioned) method of linking the 2nd form to a BO. Do you put a separate one on the 2nd form and use a copydata function? Do you pass a reference to the BO on the first form? Does the DataLayer take care of this automatically somehow?
My inclination would be to create all of the BOs in some root form and then pass references to those BOs to each subordinate form as I create or activate them. Is this an acceptable/desireable approach?
What would you recommend?
|
By Trent L. Taylor - 3/10/2006
Daniel, Sorry for the delayed response. I literally just walkted in the door from Little Rock which is about 650 miles from here. There was a .NET Users conference that I was at. To answer your question, there is actually a sample that comes with the framework. It is a C# example, which is what you use if I remember correctly. To get to the sample, click on the Start -> Programs -> MicroFour StrataFrame -> CSharp Samples -> CSharp -> Child Form Dialog. This is actually what the ChildFormDialog control does for you. It translates an instance of a business object on one form to an separate instance on another form. This is a very nice feature and makes it really easy to reference a single instance across multiple forms. However, you can use some of the approaches you mentioned as well. Depending upon your circumstances, you may want to pass the reference to the child form. If you use the ChildFormDialog control, you don't have to worry about the translation. What is really nice is that you program the child form (including the references in code) to the BO instance that is dropped on that form. When you call the child form through the CHildFormDialog control, it will automatically manage the delegates, code references, and anything that touches the BO instance on the child form for you automatically. So this is my recommended route. But if this does not answer your question, please let me know. |
|
By Daniel Essin - 3/10/2006
I will give it a try.
Also, I'm having some trouble getting a listview to populate manually after invoking a fill method. IfI use FillTop100Affinity as the formLoad type of population, the list populates. If I do something like below, it does not.
private void buttonSearch_Click(object sender, EventArgs e)
{
if (_Mode == EntitySelectMode.PROGRAM)
{
_Entity.FillOneFromEnrolledProgram(textMRN.Text, _ProgramName);
}
else
{
_Entity.FillTop100Affinity();
//_Entity.FillFromAffinity(textMRN.Text);
}
}
private void listView1_ListPopulating(MicroFour.StrataFrame.UI.ListPopulatingEventArgs e)
{
e.Parameters[0].Value = _Entity;
e.Parameters[1].Value = MicroFour.StrataFrame.Business.BusinessCloneDataType.ClearAndFillFromCompleteTable;
}
|
By Trent L. Taylor - 3/10/2006
From looking at the ListPopulating event, I assume that your PopulationDataSource settings is using the Entity BO and the method selected is CopyDataFrom(BusinessLayer, FillType). If so, are you calling the ListView.Requery() method after you fill the business object in the button click. If you do not call the ListView.Requery() method, it will not populate with the new contents of the business object. I think this is your problem. Let me know.
|
By Daniel Essin - 3/11/2006
I'm making a bit of headway on this. Are the listviews "bound" to the BO's? When I click on a row in the listview it does not seem to navigate to the corrensponding row in the BO like am used to with other databinging techniques that I have tried.
How do I do it? Is some kind of manual navigate call required?
|
By Trent L. Taylor - 3/12/2006
When populating a listview an internal instance of the BO is dynamically created. Even if you use the CopyDataFrom method, it is using the internal BO of the listview to populate itself. To navigate a specific instance of a BO to another record place the following code in the SelectedIndexChanged event of the listview:If MyListView.SelectedItems.Count > 0
FormInstanceBO.NavigateToPrimaryKey(CType(MyListView.SelectedItem(0).Tag, Integer)) End IfObviously you will need to make any necessary changes to match your PK value.
|
|