Subject TIB_LookupEnh in search mode
Author Marcin Bury
Hello

In my application I have a routine that puts current field value into search criteria and post the dataset's search state.

For TIB_LookupEnh controls it looks like this:


          if Screen.ActiveControl is TIB_LookupEnh
              then begin
                    aFieldName := TIB_LookupEnh(Screen.ActiveControl).DataField;
                    aDisplayFieldName := TIB_LookupEnh(Screen.ActiveControl).DisplayField;
                    if TIB_LookupEnh(Screen.ActiveControl).DataSource.Dataset.FieldByName(aFieldName).AsString <> ''
                     then begin
                           aFieldValue := TIB_LookupEnh(Screen.ActiveControl).DataSource.Dataset.FieldByName(aFieldName).Value;
                           aDisplayValue := TIB_LookupEnh(Screen.ActiveControl).DataSource.Dataset.FieldByName(aDisplayFieldName).Value;
                           TIB_LookupEnh(Screen.ActiveControl).DataSource.Dataset.Search;
                           TIB_LookupEnh(Screen.ActiveControl).SearchBuffer := aFieldValue;
                           TIB_Control(Screen.ActiveControl).
                           TIB_EditEnh(Screen.ActiveControl).DataSource.Dataset.Post;
                       
                           bFilterOff.Visible := True;
                          end;
                   end

It works great, till the moment I explicitly put the dataset into search mode. Then TIB_LookupEnh control displays the value of DataField instead of the value of DisplayField.
Apparently I missed some assignment. Can someone tell me where should I put the value of DisplayField to have it shown in search mode?

Another question that raises here is: Is there a way to check in some dataset's event (i.e after post when posted state was dssSearch) that any search criteria were set? I've tried:

DataSet.SearchCriteria.Count

but it always returns 0 (zero)

Thanks in advance
Marcin