| | | StrataFrame VIP
       
Group: StrataFrame Users Last Login: 2 days ago @ 8:30:35 PM Posts: 1,164, Visits: 2,903 |
| Thanks Greg, much appreciated. 
Any time! |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 9:36:54 PM Posts: 4,200, Visits: 4,251 |
| the form is shown as modal as it should, but it is outside the MDI parent form, is there a way to tell the ChildForm to be part of the MDI form? Technically, yes...however, this defies the nature of a modal dialog. You actually can do this, but you will have some other issues and side-effects. You can provide the owner of the dialog when you call the ShowDialog method on a form. If not provided, then it will appear in the screen. Initially we started down this path with our medical application and we backed off and let "nature" take its course and we have been far better off. To allow this to happen through the ListView and ChildDialog form would require that we add another event for you to provide the owner handle. I will add this to the list and consider it, but it is one of those things that may not make it if there are more liabilities than benefits. |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: 07/16/2008 12:26:47 PM Posts: 405, Visits: 1,682 |
| Trent L. Taylor (04/27/2008)
[quote]Initially we started down this path with our medical application and we backed off and let "nature" take its course and we have been far better off. To allow this to happen through the ListView and ChildDialog form would require that we add another event for you to provide the owner handle. I will add this to the list and consider it, but it is one of those things that may not make it if there are more liabilities than benefits. Thanks for the confirmation. I will use it as it is now, so there will be not need to add another event unless you want to open up the possiblities.
Edhy RijoProgytech (Computer Consultants) |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: 07/16/2008 12:26:47 PM Posts: 405, Visits: 1,682 |
| | Hi Trent, Following my working with the ListView, I noticed that when using the ListView in a One2Many form and there is not record in the parent BO the Add button of the the ListView is still Enabled which will caused an error when clicking this button and the ChildForm will try to update the FK key with no valid record in the parent. I have been looking at the source and the list events to see where I could put code to disable the cmdAdd button in the list if there is no parent record. Can you please give me hand here?
Edhy RijoProgytech (Computer Consultants) |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 9:36:54 PM Posts: 4,200, Visits: 4,251 |
| Generally I do not allow access to the Toolstrip item if there is not a parent record available. The ListView will not always be calling a "child" table. Even though a ChildFormDialog will be shown, it may be the parent record. This is something that I generally do not fight as I have a single method that I funnel all form enables and disables through...as well as testing on certain security elements. I generally call this UpdateFormStates()....but you could call it whatever you want. Then I call this when in the parent BOs Navigated, CurrentTableRefilled, and IsDirtyChanges events. In this method I then set things that would be handled by a zero count, etc:Private Sub UpdateFormStates() '-- Establish Locals Dim isAddAllowed As Boolean = MyParentBO.Count > 0 '-- Set controls that require a parent record MyAddButton.Enabled = isAddAllowed End Sub It is possible to add functionality to do this within the ListView, but it would require that a reference to the parent BO be provided and another property or two. I will consider this when I make some changes before the next update, but for now this is what I would do. In fact, this is what I do  |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: 07/16/2008 12:26:47 PM Posts: 405, Visits: 1,682 |
| Trent L. Taylor (04/29/2008)
It is possible to add functionality to do this within the ListView, but it would require that a reference to the parent BO be provided and another property or two. I will consider this when I make some changes before the next update, but for now this is what I would do. In fact, this is what I do  Hi Trent, Thanks for the suggestions, I implemented them and still the Add button is always enabled not matter what. Following the ListView source code I noticed that in the method UpdateObjectStates() is executed at the end of the PopulateListView() method and this method will set the Add button Enabled=True based on the HasPermission() method which will always return True if no Security is used yet (my case). I would try adding my code in the AfterRequery() Event, but this event is raised before the UpdateObjectStates() method. You can try this and verify that the Add button will always be Enabled. ''' <summary>''' The main method to populate the list view through the population settings''' </summary>''' <remarks></remarks>Private Sub PopulateListView(ByVal ParamArray Parameters As Object()) '-- Establish locals Dim loBO As BusinessLayer Dim lnCnt As Integer If Me._PopulationDataSourceSettings IsNot Nothing Then '-- Stop the processing of messages Me.SuspendLayout() Me.BeginUpdate() '-- Clear the list Items.Clear() '-- Get the datatable loBO = GetFilledBusinessObject(Parameters) '-- Cycle through the rows of the datatable and start populating the list view For lnCnt = 0 To loBO.Count - 1 '-- Move to the row we need loBO.MoveAbsolute(lnCnt) '-- add the item to the list Me.Items.Add(CreateListViewItem(loBO)) Next '-- Resume the drawing and processing Me.EndUpdate() Me.ResumeLayout() End If RaiseAfterRequeryEvent() '-- Update the states of the objects UpdateObjectStates() End Sub
Edhy RijoProgytech (Computer Consultants) |
| | | | StrataFrame VIP
       
Group: StrataFrame Users Last Login: 2 days ago @ 8:30:35 PM Posts: 1,164, Visits: 2,903 |
| Edhy,
You need to call the UpdateObjectStates() method whenever the monitored state changes. I.e. in this case, as Trent mentioned, you need to call this when the state of the parent BO could change, like when it is loaded, navigated, added, deleted, undone (maybe not all of these, but hopefully you get the idea). You don't need this here necessarily, unless loading the list could also change a monitored state (e.g. you have some object that requires an item selected within the list). Hope that makes sense. |
| | | | StrataFrame VIP
  |
| |
|