Advertisement
zoltanleo

Untitled

Feb 9th, 2024
1,620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.66 KB | None | 0 0
  1.   with TDBEditEh(Sender) do
  2.   begin
  3.     if (Length(Trim(Text)) <= 3) then
  4.     begin
  5.       MRUList.CloseUp(True); //схлопываем MRU-лист
  6.       MRUList.Active := False; //отключаем MRU-лист
  7.       Exit; //уходим, т.к. не из чего выбирать или потенциально слишком большой выбор
  8.     end;
  9.   end;
  10.  
  11.   with TDBEditEh(Sender) do
  12.   begin
  13.     MRUList.Items.Clear; //чистим MRU-лист
  14.     MRUList.Rows := 10; //показываем только 10 строк
  15.     MRUList.Active:= True; //включаем MRU-лист
  16.     MRUList.DroppedDown:= True;
  17.  
  18.     mds_mru.Filtered:= False;
  19.  
  20.     case MRUFilterSender of
  21.       mfsLastName: FilterValue:= Format('(UPPER(ANKLASTNAME) LIKE UPPER(''%%%s%%''))',[UpperCase(Trim(EdtLastName.Text),loUserLocale)]);
  22.       mfsFirstName: FilterValue:= Format('(UPPER(ANKFIRSTNAME) LIKE UPPER(''%%%s%%''))',[UpperCase(Trim(EdtFirstName.Text), loUserLocale)]);
  23.       mfsThirdName: FilterValue:= Format('(UPPER(ANKTHIRDNAME) LIKE UPPER(''%%%s%%''))',[UpperCase(Trim(EdtThirdName.Text), loUserLocale)]);
  24.     end;
  25.  
  26.     mds_mru.Filter:= FilterValue;
  27.     mds_mru.Filtered:= True;
  28.  
  29.     if mds_mru.IsEmpty then Exit;
  30.  
  31.     i:= 0;
  32.     mds_mru.First;
  33.  
  34.     while (not mds_mru.Eof or (i <= maxCount)) do
  35.     begin
  36.       case MRUFilterSender of
  37.         mfsLastName:  MRUList.Add(Trim(mds_mru.FieldByName('ANKLASTNAME').AsString));
  38.         mfsFirstName: MRUList.Add(Trim(mds_mru.FieldByName('ANKFIRSTNAME').AsString));
  39.         mfsThirdName: MRUList.Add(Trim(mds_mru.FieldByName('ANKTHIRDNAME').AsString));
  40.       end;
  41.  
  42.       Inc(i);
  43.       mds_mru.Next;
  44.     end;
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement