Beta 1.6.5.1: ListView enhanced features....


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Really, we didn't even do that in VFP (bad word, I know BigGrin).  We used table buffering and didn't commit the changes until down stream.  Granted, it was nowhere as clean as using the BOs and disconnected data, but the concept was really the same.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Trent,

Refactoring my child forms, i have a situation with my current code in the ChildForm Save button:

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click

     '-- Use the form' Save method to force the Broken Rules to be check and show the Broken Rule InfoBox if needed.

     If Me.Save() <> MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

          Exit Sub

     ElseIf Me.Save() = MicroFour.StrataFrame.Data.SaveUndoResult.Success Then

          Me.DialogResult = Windows.Forms.DialogResult.OK

     Else

          Me.PolicyBO1.Undo(MicroFour.StrataFrame.Business.BusinessUndoType.CurrentRowOnly)

          Me.DialogResult = Windows.Forms.DialogResult.Cancel

     End If

End Sub

As you can see, I am using the Form's Save() to force the Broken Rules check and show the InfoBox.  But intent to refactor it to simply check for broken rules and return a DialogResult.OK as it should be.

In the CustomerNodeEditor form this code is being used for the same reason:

Private Sub cmdSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdSave.Click

     '-- Check the rules on the business object. We are not going to save

     '-- until we get all the way back to the parent form. A save could

     '-- be executed here if necessary, however, since this is a child

     '-- form, the parent form usually controls the saves. The true

     '-- will show the InfoBox error window if the rules are broken.

     If CustomerNotes.CheckRulesOnRow(True) Then

          Me.DialogResult = System.Windows.Forms.DialogResult.OK

     End If

End Sub

The CheckRulesOnRow(True) is not working in a sense that is not showing the required fields nor showing the InfoBox to inform the user that there is a problem with that record, but it is not entering the IF condition which mean that it is partially working.

How can I deal with this situation since in all my ChildForms I need to check for broken rules defined in the BO class?

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Just call the CheckRules method, not the CheckRulesOnRow.  For example:

If MyBo.CheckRules(True) Then
    DialogResult = OK
End If

All of the error providers will then work, however, the InfoBox will not appear and this is by design.  That logic is placed in the Save() of the BaseForm and creates a collection list...however, you can add this yourself very easily in your BaseBO.  Just handle the BusinessRulesChecked event of the BaseBO, and you will probably want to have a property that determines if the InfoBox will be shown when there are broken rules (this too would be on your BaseBo).  The only other property that you may consider adding or testing for is the parent form (or which ever form you may want the InfoBox to show within).  But you would then call the InfoBox like this:

If e.CountOfBrokenRulesAdditionalRows > 0 Then
    InfoBox.ErrorBox(...)
Else
    InfoBox.ErrorBox(...)
End If

You can look at the BaseForm in the Business assembly of the source to see what we do in that dialog.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

In the latest update 1.6.6 a new event BeforeChildFormExecuted was added to the ListView control.  I noticed that in the ListViewBeforeChildExecuteEventArgs there is no Cancel property to cancel any action handled by the ListView control.

Would it be necessary to add the e.Cancel property, or is there any other way to abort any of the 3 actions allow in the ListView (Add/Edit/Delete)?



Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Oh, I suppose we could add a cancel parm.  It was created so that there could be a centralized localization for pre-child form initialization code.  Technically the action is already in progress (Delete would actually never hit this event).  So either an Add or Edit will already be in progress.  Adding a cancel shouldn't be too big of a deal, so I will add this to the list.
Guillermo Vilas
Guillermo Vilas
StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)StrataFrame User (192 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 2.3K
I think the ListViewBeforeChildExecuteEventArgs event would be a good place to add extra params to send to the Child Form.

------------------------------------------------------------------------
I would like to change the world, but they don´t give me the source code.
MS Windows 7 Ultimate 64-Bit
Intel(R) Core(TM)2 Quad CPU Q9300 2.50 GHz
6.00 GB of RAM, NVIDIA GeForce 9800 GT

MacBook Pro i5 OSX Lion
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

Trent L. Taylor (06/24/2008)
Oh, I suppose we could add a cancel parm.  It was created so that there could be a centralized localization for pre-child form initialization code.  Technically the action is already in progress (Delete would actually never hit this event).  So either an Add or Edit will already be in progress.  Adding a cancel shouldn't be too big of a deal, so I will add this to the list.

I really have the need to be able to cancel out showing the childform dialog from the listview BeforeChildFormExecuted, I have not find a way to do this in a form without having to have all the listview code in the form to manage it. 

Have you consider adding an e.Cancel parameter?



Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Done, it will be in the next update.  We will post a 1.6.7 beta build in the next week or two, but this will be included.  Here is the update:

The ListView BeforeChildFormExecuted event now has a CancelAction parm on the event argument which allows several options.  None, which would continue as normal, cancel the ChildFormDialog execution only, or cancel the dialog execution and undo any data changes related to the currently executed action (i.e. if adding a new record the new record would not be added).  This gives the best of all worlds in regards to the potential needs to cancelling an automated ChildFormDialog execution.

Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Excellent!  this much more than what I asked.

Thanks Tongue

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search