Keyboard behaviour with Listview Child form


Author
Message
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You're welcome, Andy.

Glad I could help. http://forum.strataframe.net/Skins/Classic/Images/EmotIcons/Cool.gif
Edited 13 Years Ago by Ivan George Borges
Andrew Harper
Andrew Harper
StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)
Group: StrataFrame Users
Posts: 87, Visits: 3.3K
Hi Ivan,

Thanks for the prompt reponse - with some additional changes I now have the listview working correctly for add & delete as well as edit.

Best regards and thanks,

Andy
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)Strategic Support Team Member (3.4K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Andrew.

First, create a Private Field to house the row index:

    Private _RowIndex As Integer = 0


Then, in the lstCast_ChildFormResults, set the row index before the listview gets requeried:

    Private Sub lstCast_ChildFormResults(ByVal sender As System.Object, ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.ListViewChildFormResultsEventArgs) Handles lstCast.ChildFormResults
        If e.Results = Windows.Forms.DialogResult.Cancel Then
            MovieCast.RestoreCurrentDataTableSnapshot(False)
        Else
            _RowIndex = lstCast.FocusedItem.Index
            e.Requery = True
        End If
    End Sub


Finally, add an AfterRequery event handler for the listview to reset the row index:

    Private Sub lstCast_AfterRequery() Handles lstCast.AfterRequery
        lstCast.Items(_RowIndex).Selected = True
        lstCast.Items(_RowIndex).Focused = True
    End Sub


Boa noite!


 
Andrew Harper
Andrew Harper
StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)StrataFrame User (280 reputation)
Group: StrataFrame Users
Posts: 87, Visits: 3.3K
Hi,

We are looking to redevelop a major application for a client and as part of a pilot project I have developed a maintenance form that uses a listview with a child form. The users of our existing application are used to being able to do what they need via the keyboard with minimal use of the mouse.

I examined the Strataflix sample and developed the form using the same techniques as the Movie Database maintenance form. The problem we have is if the user presses downarrow after successfully editing a child record they are positioned on the first record in the listview not the record below the highlighted record that has just been edited.

This can be replicated in the Strataflix application as follows:

1. Choose the Movie Database and select the Find a Movie option

2. Enter "Gone with the Wind" in the browse dialogue, click search and choose the first movie listed

3. In the Cast Members list select  "Leigh, Vivien"

4. Click edit

5. Change the character name to "Scarlett O'Hara"

6. Click OK - the listview is updated and Vivien Leigh is highlighted and displayed correctly

7. Press downarrow

8. The listview highlights the first record in the list not the record below Vivien Leigh.

I suspect that the Listview is losing focus but have not been able to rectify the behaviour - any suggestions appreciated,

TIA

Andy
Edited 13 Years Ago by Andrew Harper
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