MaintenanceFormToolStrip Uasge


Author
Message
franka
franka
StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)
Group: Forum Members
Posts: 22, Visits: 35
I have a SF form that I added a MaintenanceFormToolStrip to.  I want to use the maintenance buttons (New, Edit, Save, etc.) but not the naviagtion buttons which I have turned off.  Instead I want to use a ListView control for navigation.  Everything works fine except for the refreshing/updating of the listview.  How can I keep the listview in sync with the maintenance that is being performed?  Call the requery method on the listview?  At what point?

Thanks!!

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You'll need to refresh the list view whenever the data within the business object changes. What I would do is add a handler to the AfterSave event of the business object on the form and call ListView.Requery() in there.



Within the list population, you might look at using the CopyDataFrom method for the business object rather than pulling the data from the database every time. If you do that, then you can Requery() the ListView as often as you want without worrying about roudtrips to the database. You'll be able to put a Requery() in the Navigated event and possibly even the FieldPropertyChanged event (you'll have to configure your business object to have changed events in the BOMapper and rebuild the partial class before you'll see that event on your business object).
franka
franka
StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)
Group: Forum Members
Posts: 22, Visits: 35
Thanks Ben.  The requery works fine but I have another problem that I can't figure out and maybe you can help.  When I perform the requery I programatically select the item in the list I want highlighted.  That works fine.  But if the selected item is not within the viewable portion of the list, the scroll position is not chantged to allow the selected item to be in the display window.  How can I scroll the listview to insure the selected item is in the displayable portion of the control?  Here's my code:

Private Sub AttendingsBO_AfterSave(ByVal e As MicroFour.StrataFrame.Data.AfterSaveUndoEventArgs)   Handles AttendingsBO.AfterSave

Me.lvAttendings.Requery()

Dim strKey As String

Dim intX As Integer

strKey = Me.AttendingsBO.CurrentRow.Item("OPH_ID")

For intX = 0 To Me.lvAttendings.Items.Count - 1

If Me.lvAttendings.Items(intX).SubItems(1).Text = strKey Then

Me.lvAttendings.Items(intX).Selected = True

Me.lvAttendings.Select()

Exit For

End If

Next

End Sub


StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Hi Frank,



Glad that worked for you. To get the list view to scroll to that record, you need to put this line of code after you select the row:



Me.lvAttendings.EnsureVisible(intX)



Put that right before the Exit For, and the ListView will scroll to that record and make sure that it is visible.
franka
franka
StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)StrataFrame Beginner (28 reputation)
Group: Forum Members
Posts: 22, Visits: 35
Dahhh!!!  Don't know how I missed that property.  Thanks!!Doze
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
I didn't know it was there until Trent pointed it out one day Whistling
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