anchor.diff:    Classes, Controls, Graphics, StdCtrls, StrUtils, Contnrs, Variants,
     ExtCtrls, EditBtn, Menus, {$IFNDEF LINUX}Windows, {$ENDIF}
     mFilter, mFilterOperators, mBaseClassesAsObjects, mMathUtility,
  -  mUtility, mDateEdit;
  +  mUtility, mDateEdit, mVirtualFieldDefs, mVirtualDataSetInterfaces;
   
   type
     { TmFilterConditionPanel }
  
positive.code:     FAllowedOperators : TmFilterOperatorsSet;
      function CreateStandardLabel: TLabel;
      function CreateStandardOperatorMenu (aLabel: TLabel) : TPopupMenu;
      function FormatFilterCaption (aValue : String) : String;
      procedure UpdateCurrentOperatorCheck;
      procedure OperatorMenuItemClick (Sender : TObject);
      procedure OperatorMenuPopup (Sender : TObject);
  
negative.code: implementation
  
  uses
    SysUtils,
    mQuickReadOnlyVirtualDataSet, mLookupForm, mVirtualDataSet;
  
  const
    DEFAULT_FLEX_WIDTH = 50;
  
  { TmLookupFilterConditionPanel }
  
  procedure TmLookupFilterConditionPanel.OnEditValueChanged(Sender: TObject);
  begin
  
  end;
  
  procedure TmLookupFilterConditionPanel.OnShowLookup(Sender: TObject);
  var
    lookupFrm: TmLookupWindow;
    tmpDataset: TmVirtualDataset;
    tmpDatasetProvider: TReadOnlyVirtualDatasetProvider;
    str: String;
    tmpDatum: IVDDatum;
  begin
    if FKeyFieldName = '' then
      raise Exception.Create('[TmLookupFilterConditionPanel] Missing KeyFieldName.');
    if FValueFieldName = '' then
      raise Exception.Create('[TmLookupFilterConditionPanel] Missing ValueFieldName.');
    if FDescriptionFieldName = '' then
      raise Exception.Create('[TmLookupFilterConditionPanel] Missing DescriptionFieldName.');
    if not Assigned(FOnFillVirtualFieldDefs) then
      raise Exception.Create('[TmLookupFilterConditionPanel] Missing OnFillVirtualFieldDefs.');
  
    if not Assigned(FListDataProvider) then
      raise Exception.Create('[TmLookupFilterConditionPanel] Missing ListDataProvider.');
  
    if FLookupFieldNames.Count = 0 then
      raise Exception.Create('[TmLookupFilterConditionPanel] Missing field names.');
  
    lookupFrm := TmLookupWindow.Create(Self);
    try
      tmpDatasetProvider := TReadOnlyVirtualDatasetProvider.Create;
      tmpDataset := TmVirtualDataset.Create(Self);
      try
        tmpDataset.DatasetDataProvider := tmpDatasetProvider;
  
        tmpDatasetProvider.Init(FListDataProvider);
        FOnFillVirtualFieldDefs(tmpDatasetProvider.VirtualFieldDefs);
  
        tmpDataset.Active:= true;
        tmpDataset.Refresh;
        lookupFrm.Init(tmpDataset, FLookupFieldNames, FKeyFieldName);
        if lookupFrm.ShowModal = mrOk then
        begin
          tmpDatum := FListDataProvider.FindDatumByStringKey(lookupFrm.Selected);
          if Assigned(tmpDatum) then
          begin
            FEdit.Text:= VarToStr(tmpDatum.GetPropertyByFieldName(FDescriptionFieldName));
            FCurrentValue:= tmpDatum.GetPropertyByFieldName(FValueFieldName);
          end;
        end;
      finally
        tmpDataset.Free;
        tmpDatasetProvider.Free;
      end;
  
    finally
      lookupFrm.Free;
    end;
  end;
  
  
  constructor TmLookupFilterConditionPanel.Create(TheOwner: TComponent);
  begin
    inherited Create(TheOwner);
    FCurrentValue:= null;
    FEdit := TEditButton.Create(Self);
    FEdit.Parent := Self;
    FEdit.Align := alBottom;
    FEdit.Text := '';
    FEdit.DirectInput:= false;
    FEdit.OnEditingDone:= Self.OnEditValueChanged;
    FEdit.ButtonCaption:='...';
    FEdit.OnButtonClick:= Self.OnShowLookup;
    FLabel := Self.CreateStandardLabel;
    FValueType:= efString;
    CreateStandardOperatorMenu(FLabel);
    FKeyFieldName:= '';
    FValueFieldName:= '';
    FDescriptionFieldName:= '';
    FOnFillVirtualFieldDefs:= nil;
    FLookupFieldNames := TStringList.Create;
  end;
  
  destructor TmLookupFilterConditionPanel.Destroy;
  begin
    FLookupFieldNames.Free;
    inherited Destroy;
  end;
  
  procedure TmLookupFilterConditionPanel.SetFilterCaption(aValue: String);
  begin
    inherited SetFilterCaption(aValue);
    FLabel.Caption := Self.FormatFilterCaption(aValue, false);
  end;
  
  procedure TmLookupFilterConditionPanel.ExportToFilter(aFilter: TmFilter);
  begin
    inherited ExportToFilter(aFilter);
    aFilter.DataType:= fdtString;
    if VarIsNull(FCurrentValue) then
      aFilter.Value := null
    else if FValueType = efUppercaseString then
      aFilter.Value := Uppercase(VarToStr(FCurrentValue))
    else
    if FValueType = efInteger then
    begin
      if VarIsNumeric(FCurrentValue) then
        aFilter.Value := FCurrentValue
      else
        aFilter.Value := null;
      aFilter.DataType:= fdtInteger;
    end
    else
    if FValueType = efFloat then
    begin
      if VarIsFloat(FCurrentValue) then
        aFilter.Value := FCurrentValue
      else
        aFilter.Value := null;
      aFilter.DataType:= fdtFloat;
    end
    else
      aFilter.Value := FCurrentValue;
  end;
  
  procedure TmLookupFilterConditionPanel.SetFilterValue(const aValue : Variant; const aDescription: String);
  begin
    if VarIsNull(aValue) then
      Self.Clear
    else
    begin
      FCurrentValue:= aValue;
      FEdit.Text := aDescription;
    end;
  end;
  
  function TmLookupFilterConditionPanel.IsEmpty: boolean;
  begin
    Result := VarIsNull(FCurrentValue);
  end;
  
  procedure TmLookupFilterConditionPanel.Clear;
  begin
    FEdit.Text:= '';
    FCurrentValue:= null;
  end;
  
    {$IFDEF LINUX}
    CB_SETDROPPEDWIDTH = 352;
    {$ENDIF}
  