StrataFrame Forum

Browse Dialog Search Text

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

By Mike Tomlin - 5/25/2011

Is there a way to access the text or selections a user makes in the Browse Dialog search fields so I can record what they actually entered as search criteria?

Thanks

Mike
By Trent L. Taylor - 5/25/2011

Well, through the BrowseDialog control itself, no.  This would require that the values are passed back through an event.  However, if you have a BrowseInformationPanel in the browse dialog, you can actually get to the entire form from there including the fields.  There is a property called "this.BrowseDialogWindowReference" that will give you a direct reference to the dialog.  At that point, you can get to pretty much anything you want.
By Ivan George Borges - 5/25/2011

Hi there.

I hope I will be told that I shouldn't be doing what I am doing, but I am using the SearchValueChanged for things like these. Smile

I did have to make a small change into the BrowseDialog source code, since the OK button wouldn't trigger the SearchValueChanged for the control that had the last focus, being this a search field. What I did was to create a text control in the BD form and I move the focus to it and then back to where it was when the OK is pressed.

This is what I do in the SearchValueChanged:



    Private Sub YourBrowseDialog_SearchValueChanged(ByVal sender As Object, _
                ByVal e As MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogSearchValueChangedEventArgs) _
                Handles Me.SearchValueChanged
        '-- check if a combo was chosen
        If e.SourceSearchField.Key.Equals("YourComboValueField")
            '-- Establish locals
            Dim yourInteger as Integer
 
            '-- get the value
            yourInteger = CType(CType(e.SourceControl, ComboBox).SelectedValue, Integer)
          
           '-- do whatever needed
        End If

        '-- check if a Text was chosen
        If e.SourceSearchField.Key = "YourTextField" Then
            '-- Establish locals
            Dim yourText As String

            '-- get your text
            yourText = e.SourceControl.Text
        End If
       
        '-- and so on...
    End Sub