Beta 1.6.5.1: ListView enhanced features....
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


12345»»»

Beta 1.6.5.1: ListView enhanced features....Expand / Collapse
Author
Message
Posted 04/17/2008 12:39:28 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:29:20 PM
Posts: 400, Visits: 1,612
Hi Trent,

First, thanks for all the enhancements done to the ListView, very impressive

I setup a form to test the ListView and found the following issues:

  • Moving the record pointer in the ToolStrip button does not update/refresh the ListView.
  • Creating a new record or modifying an existing one does not Refresh the ListView with the updated data.

I tested the functionality of the Add/Delete/Edit Objects and they all worked as expected. 

One question, when using the ListView with a child BO, I may need to have buttons for Save/Undo if not using a childform object, would you consider adding a SaveObject/UndoObject as well for this case?

Please take a loot at the video in this link:  http://www.progytech.com/videos/Beta_ListView\Beta_ListView.html

Edhy Rijo
Progytech (Computer Consultants)
Post #15732
Posted 04/17/2008 12:52:50 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
Moving the record pointer in the ToolStrip button does not update/refresh the ListView.

Not supposed to.  The two are separate.  I might add something so that it auto-navigates from an external source, but for now there is not an issue because it wasn't supposed to move.  The auto-navigation occurs when the item is selected within the list, not the other way around.

Creating a new record or modifying an existing one does not Refresh the ListView with the updated data.

You have to handle the ChildFormResults event and if you want it to requery set the event arg and it will then requery itself:

e.Requery = True
Post #15734
Posted 04/17/2008 12:54:30 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
One question, when using the ListView with a child BO, I may need to have buttons for Save/Undo if not using a childform object, would you consider adding a SaveObject/UndoObject as well for this case?

I will consider it.  This is pretty far out of the norm since your child logic should not generally be separate from the rest of the environment and there may be more than one BO that requires saving, etc.  So this gets more complicated in that sense. 

Post #15735
Posted 04/22/2008 11:48:12 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:29:20 PM
Posts: 400, Visits: 1,612
Trent,

Following the ListView enhancements, in the following code

Private Sub AddNewChildRecord()

     '-- If no business object is attached then there is nothing to do

     If _BusinessObject Is Nothing Then Exit Sub

          '-- Add the new record

          _BusinessObject.Add()

          '-- See if there is a child dialog

          If _ChildForm IsNot Nothing Then

               '-- Call the child form and create the args

               Dim args As New ListViewChildFormResultsEventArgs(_ChildForm.ShowDialog())

               '-- Raise the event

               Me.OnChildFormResults(args)

               '-- See if the list should be requeried

               If args.Requery Then

                    '-- Save off the primary key value

                    Dim reselect As Boolean = True

                    Dim pk As Object = Nothing

                    Try

                         pk = _BusinessObject.CurrentRow(_BusinessObject.PrimaryKeyField)

                    Catch ex As Exception

                         reselect = False

                    End Try

                    '-- Requery the list

                    Me.Requery()

                    '-- Attempt to select the item

                    If reselect Then SelectIndexByPrimaryKey(pk)

               End If

          End If

End Sub

The code that check if the list should be requeried will only run if a ChildForm exist and that may not be case if no ChildForm is used, but there is still the need for the list to be requeried. 

Do you think that the new ListView event ChildFormResults could be raised even if a ChildForm is not being used? or is there a way I can manually raise this event so I can force the code to Requery the view to be run at will?

Edhy Rijo
Progytech (Computer Consultants)
Post #15818
Posted 04/25/2008 1:23:12 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:29:20 PM
Posts: 400, Visits: 1,612
HI Trent,

Still working with the ListView enhancements, I am having a problem when trying to Edit a record in the ListView this time using a ChildForm I get this error:

BusinessLayerException
  There are no rows in the current data table.  An edit is not allowed.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at MicroFour.StrataFrame.Business.BusinessLayer.Edit(Boolean CheckSecurity)
   at MicroFour.StrataFrame.Business.BusinessLayer.Edit()
   at MicroFour.StrataFrame.UI.Windows.Forms.ListView.EditChildRecord()
   at MicroFour.StrataFrame.UI.Windows.Forms.ListView.HandleObjectClick(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativewindow.WndProc(Message& m)
   at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I don't have any problem when adding new records, and even after adding new records I am able to Edit current records in the listview.

For the ChildForm, I created this form with a SF MaintenanceForm class and added the child BO as usual.

Please see the attached images.

Edhy Rijo
Progytech (Computer Consultants)


  Post Attachments 
ChildForm_DialogProperty.png (5 views, 16.68 KB)
ListViewProperties.png (6 views, 26.55 KB)
Post #15894
Posted 04/25/2008 1:29:44 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
You probably have a filter applied or something along those lines.  Or, you are one or two forms deep and the business object on the ListView is not translated.  In the case of the latter, manually set the BusinessObject property on the ListView in code after the BOs have been translated.  Thes best place to do this is in the OnLoad method.  The latter will only happen if you are already in a ChildForm that has been translated and are calling another child form (grand child). 

''' <summary>
''' Provide additional load logic
''' </summary>
''' <param name="e"></param>
''' <remarks></remarks>
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
    MyBase.OnLoad(e)

    '-- Force the ListView to update its reference
    MyListView.BusinessObject = Me.MyBusinessObject
   
End Sub

Post #15897
Posted 04/25/2008 2:25:34 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Today @ 3:29:20 PM
Posts: 400, Visits: 1,612
Trent,

The problem was that I was not filling the Child BO and was fooled by the data in the Child ListView.

In this regard I have a couple of question I need to clarify:

  • When loading the BO with a fill method, which event is the best one to use:
    • Form's Load or
    • BO ParentFormLoading
  • I am using the following method to fill the child BO

    Me.Child_PolicyBO1.FillByParent(Me.InsuredCustomerBO1)

    • Is this the correct method to use to fill a child BO?
  • When filling the ListView I have this code:

    Private Sub lvPolicy_ListPopulating(ByVal e As MicroFour.StrataFrame.UI.ListPopulatingEventArgs) Handles lvPolicy.ListPopulating

         ' Show only child records

         e.Parameters(0).Value = Me.InsuredCustomerBO1.PK_InsuredCustomer

    End Sub

    • Is this the correct way since the data in the ListView represent a child BO?

So far everything is working find and I just LOVE the enhancements done to the ListView, but wants to make sure I am using the proper methods and events to keep moving forward with this project.

Thanks!

Edhy Rijo
Progytech (Computer Consultants)
Post #15904