Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit UnitFavorites;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
- Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.ValEdit,
- Vcl.ExtCtrls, Vcl.StdCtrls;
- type
- TFrameFavorites = class(TFrame)
- Dictionary: TValueListEditor;
- PanelTools: TPanel;
- PanelLeft: TPanel;
- PanelRight: TPanel;
- PanelBottom: TPanel;
- ButtonDelFavorite: TButton;
- ButtonSaveChange: TButton;
- ButtonMakeFlashCard: TButton;
- PanelForFaQ: TPanel;
- ButtonHowWork: TButton;
- procedure DictionarySelectCell(Sender: TObject; ACol, ARow: Integer;
- var CanSelect: Boolean);
- procedure ButtonDelFavoriteClick(Sender: TObject);
- procedure ButtonSaveChangeClick(Sender: TObject);
- procedure ButtonMakeFlashCardClick(Sender: TObject);
- procedure ButtonHowWorkClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- implementation
- {$R *.dfm}
- uses MainForm, UnitHelp;
- type
- TWord = MainForm.TWord;
- TPartsOfSpeech = MainForm.TPartsOfSpeech;
- const
- FILE_FAVORITES = MainForm.FILE_FAVORITES;
- procedure TFrameFavorites.ButtonDelFavoriteClick(Sender: TObject);
- var
- CanSel: Boolean;
- begin
- CanSel := true;
- MainForm.FormMenu.DeleteWord(Dictionary);
- DictionarySelectCell(Sender, 0, Dictionary.Row, CanSel);
- end;
- procedure TFrameFavorites.ButtonHowWorkClick(Sender: TObject);
- begin
- UnitHelp.FormHelp.Show;
- end;
- procedure TFrameFavorites.ButtonMakeFlashCardClick(Sender: TObject);
- var
- EnglishPresence, RussianPresence: Boolean;
- begin
- EnglishPresence := MainForm.FormMenu.IsWordInDictionary(MainForm.FormMenu.FrameFlashCards.DictionaryChangeWordSet, Dictionary.Cells[1, Dictionary.Row]);
- RussianPresence := MainForm.FormMenu.IsWordInDictionary(MainForm.FormMenu.FrameFlashCards.DictionaryChangeWordSet, Dictionary.Keys[Dictionary.Row]);
- if not(EnglishPresence) and not(RussianPresence) then
- begin
- MainForm.FormMenu.WriteToFavorites(Dictionary.Row, Dictionary, FILE_FLASHCARDS);
- end;
- end;
- procedure TFrameFavorites.ButtonSaveChangeClick(Sender: TObject);
- begin
- MainForm.FormMenu.SaveDictionaryToFile(Dictionary, FILE_FAVORITES);
- end;
- procedure TFrameFavorites.DictionarySelectCell(Sender: TObject; ACol,
- ARow: Integer; var CanSelect: Boolean);
- begin
- if not(MainForm.FormMenu.IsRowEmpty(Dictionary, Dictionary.Row)) then
- begin
- ButtonDelFavorite.Enabled := true;
- ButtonMakeFlashCard.Enabled := true;
- end
- else
- begin
- ButtonDelFavorite.Enabled := false;
- ButtonMakeFlashCard.Enabled := false;
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement