Advertisement
ksyshshot

курсач 2

May 28th, 2023
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.67 KB | Source Code | 0 0
  1. unit UnitTranslateFromRussian;
  2.  
  3. interface
  4.  
  5. uses
  6.   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
  7.   Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.ValEdit,
  8.   Vcl.ExtCtrls, Vcl.StdCtrls;
  9.  
  10. type
  11.   TFrameTranslateFromRussian = class(TFrame)
  12.     Dictionary: TValueListEditor;
  13.     PanelSearch: TPanel;
  14.     EditSearch: TLabeledEdit;
  15.     PanelLeftBorder: TPanel;
  16.     PanelRightBorder: TPanel;
  17.     PanelBottomBorder: TPanel;
  18.     ComboBoxSort: TComboBox;
  19.     SearchDictionary: TValueListEditor;
  20.     procedure EditSearchKeyPress(Sender: TObject; var Key: Char);
  21.     procedure EditSearchChange(Sender: TObject);
  22.   private
  23.     { Private declarations }
  24.   public
  25.     { Public declarations }
  26.   end;
  27.  
  28. implementation
  29.  
  30. {$R *.dfm}
  31.  
  32. uses MainForm;
  33.  
  34. type
  35.     TPartsOfSpeech = MainForm.TPartsOfSpeech;
  36.     TWord = MainForm.TWord;
  37.  
  38. procedure TFrameTranslateFromRussian.EditSearchChange(Sender: TObject);
  39. begin
  40.     MainForm.FormMenu.ClearDictionary(SearchDictionary, (SearchDictionary.RowCount - 1));
  41.     SearchDictionary.Visible := MainForm.FormMenu.Search(Dictionary, SearchDictionary, EditSearch.Text);
  42.     Dictionary.Visible := not(SearchDictionary.Visible);
  43. end;
  44.  
  45. procedure TFrameTranslateFromRussian.EditSearchKeyPress(Sender: TObject;
  46.   var Key: Char);
  47. var
  48.     EditLength: Integer;
  49. begin
  50.     EditLength := Length(EditSearch.Text);
  51.     if (Key < #192) and not(Key in [#8, #45, #28, ' ']) then
  52.         Key := #0;
  53.     if (EditLength = 0) and (Key in ['-', ' ']) then
  54.         Key := #0;
  55.     if (EditLength > 0) and (EditSearch.Text[EditLength] in ['-', ' ']) and (Key in ['-', ' ']) then
  56.         Key := #0;
  57. end;
  58.  
  59. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement