ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/ibcontrols/IBLookupComboEditBox.pas
(Generate patch)

Comparing ibx/trunk/ibcontrols/IBLookupComboEditBox.pas (file contents):
Revision 224 by tony, Fri Mar 16 10:27:26 2018 UTC vs.
Revision 225 by tony, Tue Apr 3 09:09:05 2018 UTC

# Line 345 | Line 345 | begin
345               sCompleteText := ListSource.DataSet.FieldByName(ListField).AsString;
346               if (sCompleteText <> FCurText) then
347               begin
348 +               KeyValue := ListSource.DataSet.FieldByName(KeyField).AsVariant;
349                 sResultText := sCompleteText;
350                 if ((cbactEndOfLineComplete in AutoCompleteText) and
351                           (cbactRetainPrefixCase in AutoCompleteText)) then
# Line 354 | Line 355 | begin
355                 end;
356                 Text := sResultText;
357                 SelStart := iSelStart;
358 <               SelLength := UTF8Length(Text);
358 >               SelLength := UTF8Length(Text) - iSelStart;
359               end;
359             KeyValue := ListSource.DataSet.FieldByName(KeyField).AsVariant;
360             end
361             else
362             begin
# Line 512 | Line 512 | begin
512      SelectAll;
513    end
514    else
515 +  if AutoComplete and (Style <> csDropDownList) then
516    begin
517 <    FTimer.Interval := 0;
518 <    if (IsEditableTextKey(Key) or (Key = VK_BACK))
519 <       and AutoComplete and (Style <> csDropDownList) and
520 <       (not (cbactEndOfLineComplete in AutoCompleteText) or (SelStart = UTF8Length(Text))) then
517 >    if (Key = VK_BACK) or (Key = VK_DELETE) then
518 >    begin
519 >      if SelStart = 0 then
520 >      begin
521 >        SelStart := UTF8Length(Text);
522 >        SelLength := 0;
523 >      end;
524 >      FTimer.Interval := 0;
525 >    end
526 >    else
527 >    if IsEditableTextKey(Key) and
528 >     (not(cbactEndOfLineComplete in AutoCompleteText) or (SelStart = UTF8Length(Text))) then
529 >    begin
530 >      FTimer.Interval := 0;
531        FTimer.Interval := FKeyPressInterval;
532 +    end;
533    end;
534   end;
535  
# Line 537 | Line 549 | end;
549  
550   procedure TIBLookupComboEditBox.SetItemIndex(const Val: integer);
551   begin
552 +  if Val > 0 then
553 +    FCurText := '';
554    inherited SetItemIndex(Val);
555    FLastKeyValue := KeyValue;
556   end;
# Line 562 | Line 576 | end;
576   procedure TIBLookupComboEditBox.UpdateData(Sender: TObject);
577   begin
578    inherited UpdateData(Sender);
579 +  if FCurText <> '' then
580 +    Text := FCurText + Text;
581    FModified := false;
582   end;
583  
# Line 597 | Line 613 | begin
613      FForceAutoComplete := false;
614    end;
615    CheckAndInsert;
616 +  FCurText := '';
617    if FModified then
618      Change; {ensure Update}
619    inherited EditingDone;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines