Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001678 [JEDI VCL] 00 JVCL Components minor always 2004-04-21 04:00 2004-04-22 23:39
Reporter hamilton View Status public  
Assigned To user72
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0001678: JvDBLookupCombo does not perform case insensitive search
Description I am placing a JvDBLookupCombo on a form and assigning just the datasource and datafield properties to display a fkLookup field of a ClientDataSet.

Changing the value of the IgnoreCase property has no effect.
Additional Information This behaviour is replicable using code from 2004-04-21
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0003984)
user72
2004-04-22 00:04

The problem seems to be associated with TJvLocateObject.Locate, s0 could you set a breakpoint at the first line and step through the code to see where it goes south?
(0004008)
hamilton (reporter)
2004-04-22 07:35

Your lead turned out to be correct, the problem was in the Locate method.

The dataset field I was testing with is of type ftWideString rather than ftString that Locate expected.

The line that needs to be changed in TJvLocateObject.Locate is:
  if FLookupField.DataType <> ftString then
It needs to be replaced with:
  if not ((FLookupField.DataType = ftString) or (FLookupField.DataType = ftWideString)) then
(0004020)
user72
2004-04-22 23:39

I made a slightly different change to make it easier to add new types if necessary:

function TJvLocateObject.Locate(const KeyField, KeyValue: string;
  Exact, CaseSensitive: Boolean): Boolean;
var
  LookupKey: TField;
  function IsStringType(FieldType:TFieldType):boolean;
  const
    cStringTypes = [ftString, ftWideString];
  begin
    Result := FieldType in cStringTypes;
  end;

begin
  if DataSet = nil then
  begin
    Result := False;
    Exit;
  end;
  DataSet.CheckBrowseMode;
  LookupKey := DataSet.FieldByName(KeyField);
  DataSet.CursorPosChanged;
  FLookupField := LookupKey;
  FLookupValue := KeyValue;
  FLookupExact := Exact;
  FCaseSensitive := CaseSensitive;
  if not IsStringType(FLookupField.DataType) then
  begin
    FCaseSensitive := True;
    try
      CheckFieldType(FLookupField);
    except
      Result := False;
      Exit;
    end;
  end
  else
    FCaseSensitive := CaseSensitive;
  FBookmark := DataSet.GetBookmark;
  try
    DataSet.DisableControls;
    try
      Result := MatchesLookup(FLookupField);
      if not Result then
      begin
        if UseKey then
          Result := LocateKey
        else
        begin
          if FilterApplicable then
            Result := LocateFilter
          else
            Result := LocateFull;
        end;
        if not Result then
          SetToBookmark(DataSet, FBookmark);
      end;
    finally
      DataSet.EnableControls;
    end;
  finally
    FLookupValue := EmptyStr;
    FLookupField := nil;
    DataSet.FreeBookmark(FBookmark);
    FBookmark := nil;
  end;
end;

Updated in CVS

- Issue History
Date Modified Username Field Change
2004-04-21 04:00 hamilton New Issue
2004-04-21 04:05 hamilton Issue Monitored: hamilton
2004-04-22 00:04 user72 Note Added: 0003984
2004-04-22 00:04 user72 Status new => feedback
2004-04-22 07:35 hamilton Note Added: 0004008
2004-04-22 23:39 user72 Status feedback => resolved
2004-04-22 23:39 user72 Resolution open => fixed
2004-04-22 23:39 user72 Assigned To => user72
2004-04-22 23:39 user72 Note Added: 0004020


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker