StrataFrame Forum

Browse Dialog Results

http://forum.strataframe.net/Topic19227.aspx

By Paul Chase - 9/9/2008

I have been meaning to ask for this for awhile but never get around to it and just end up doing it my local SF source then forgetting about it until the next time I update Smile. My users are migrating from a FPW app and really love the keyboard, so in trying to keep the native's happy I have my browse dialogs set up as follows I have the search key set to keys.enter and the setfocustoresultsaftersearch property to true and have added code below to the BD source to handle the lv.results key down

The idea is that a user can enter their search criteria hit enter, the results come up, and then they arrow down to the correct record, hit enter and the BD copy's data and closes form. Setting both the search and accept key to enter will not work as the search would evaluate first so it would just keep searching, so what I have been doing is trapping the Lvresults key down event and if enter copy data and close form as below. 

I'm sure you guys would want to add a property to turn this on/off and what not but if you could add this I'd sure be happy about it.

Thanks Paul

Private Sub lvResults_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lvResults.KeyDown

If e.KeyCode = Keys.Enter Then

 

If lvResults.SelectedItems().Count > 0 Then

Me.CopyDataAndCloseForm()

End If

End If

End Sub

   

By Trent L. Taylor - 9/10/2008

In case I am missing something, you should be able to do this right now....or at least get really close.  There is a propertly called SetFocusToResultsAfterSearch which will move the focus to the results set after a query...you can then use the keyboard to find the desired record.  Also, you can control the search and accept keys using the following properties:

  • AcceptKey
  • CancelKey
  • SearchKey
By Paul Chase - 9/10/2008

Trent,

One of is misssing something Smile I currently have my BD set up with the search key being enter set results to focus = true and accept key to enter. with that set up the user would

  1. enter search criteria hit enter --Search key is set to Enter
  2. Focus is set to results and user arrows through them
  3. user finds correct record and hits enter--- the form executes another search rather than accepting and closing

looak at code below and you will see what i mean,

''' <summary>

''' Pre-filters all key strokes to see if any special action needs to take place

''' </summary>

Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean

If keyData = _BrowseDialog.SearchKey Then

Me.ExecuteSearch()

ElseIf keyData = _BrowseDialog.AcceptKey Then

If Me.cmdOK.Enabled Then

CopyDataAndCloseForm()

End If

ElseIf keyData = _BrowseDialog.CancelKey Then

DialogResult = System.Windows.Forms.DialogResult.Cancel

Else

Return MyBase.ProcessCmdKey(msg, keyData)

End If

'-- Just return a value indicating the item was handled

Return True

End Function

By Ivan George Borges - 9/10/2008

I currently have my BD set up with the search key being enter

and accept key to enter.

Hey Paul.

Have you tried setting different keys to each of this actions?

By Paul Chase - 9/10/2008

Hiya Ivan,

That would work but not how my user's want it to work.BigGrin I have tried to do it with all types of combination's with the browse dialog but it is not really doable.

My users want to use the enter key for both the search and accept. So asigning the say F2 key to the accept button is not what they want they want to be able to do, they wish to do the following

  1. browse dialog displays
  2. user enter's search criteria using Tab key to go between multiple search fields
  3. user hits the enter key which then executes the search and then the focus is set to the results list view.
  4. user arrows down to correct record and then uses the Enter Key again to accept and select that record.

In other word's the Results List View would just respond to the enter key the same way it does to a double click.

 In my foxpro system the users enter their search criteria hit enter and then another modal picklist form pops up and they arrow through the results and then hit enter wich closes both the modal results form and the underlying search form and leaves them on the record they were looking for in the particular edit screen. So I am trying to emulate that  process of type first name "john" hit tab key type last name "do" hit enter set n results arrow to john doe's record hit enter form closes and I am on john does employee maintence form.

Hope that makes sence

By Edhy Rijo - 9/10/2008

Hi Paul,

And it all make sense to me, it looks like a very logic and direct approach to navigate in the Dialog Browser.

By Paul Chase - 9/11/2008

Thanks Edhy sometimes I only make sense to myself!!BigGrin