Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit QEP;
- interface
- uses
- Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
- System.Classes, Vcl.Graphics,
- Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Actions, Vcl.ActnList,
- Vcl.StdCtrls, Vcl.Buttons, Vcl.Menus, Vcl.Imaging.jpeg, Vcl.ExtCtrls,
- SignUpPG;
- type
- TfrmMainMenu = class(TForm)
- lblQuadraticEquationProgram: TLabel;
- lblEnterValues: TLabel;
- lbla: TLabel;
- edtAvalue: TEdit;
- lblb: TLabel;
- edtBvalue: TEdit;
- lblc: TLabel;
- edtCvalue: TEdit;
- btnProduce_Graph: TButton;
- btnProduce_Solution: TButton;
- cboxA: TComboBox;
- cboxB: TComboBox;
- cboxC: TComboBox;
- lblEquation: TLabel;
- imgFormula: TImage;
- LoginButton: TButton;
- edtUsername: TEdit;
- edtPassword: TEdit;
- SignUpButton: TButton;
- Label1: TLabel;
- Label2: TLabel;
- lblQE: TLabel;
- lblP: TLabel;
- procedure btnProduce_SolutionClick(Sender: TObject);
- procedure btnProduce_GraphClick(Sender: TObject);
- procedure edtAvalueChange(Sender: TObject);
- procedure edtBvalueChange(Sender: TObject);
- procedure edtCvalueChange(Sender: TObject);
- procedure cboxAChange(Sender: TObject);
- procedure cboxBChange(Sender: TObject);
- procedure cboxCChange(Sender: TObject);
- procedure edtAvalueClick(Sender: TObject);
- procedure edtBvalueClick(Sender: TObject);
- procedure edtCvalueClick(Sender: TObject);
- procedure LoginButtonClick(Sender: TObject);
- procedure edtPasswordClick(Sender: TObject);
- procedure edtUsernameClick(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure SignUpButtonClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- UserFile: TextFile;
- PSS: boolean;
- TextString, FileName: string;
- end;
- var
- frmMainMenu: TfrmMainMenu;
- implementation
- {$R *.dfm}
- uses Produce_Graph, Produce_Solution;
- procedure TfrmMainMenu.edtAvalueChange(Sender: TObject);
- var
- boxa, boxb, boxc: string;
- begin
- boxa := cboxA.text; //set the variable boxa the same as the text in CboxA
- if (boxa = '+') then //if the sign in CboxA is '+' then
- boxa := '' //set boxa as blank ''
- else
- boxa := cboxA.text; //else, show the -ve sign
- boxb := cboxB.text; //set the variable boxb the same as the text in CboxB
- if (boxb = '+') then //if the sign in CboxB is '+' then
- boxb := '' //set boxb as blank ''
- else
- boxb := cboxB.text; //else, show the -ve sign
- boxc := cboxC.text; //set the variable boxc the same as the text in CboxC
- if (boxc = '+') then //if the sign in CboxC is '+' then
- boxc := '' //set boxc as blank ''
- else
- boxc := cboxC.text; //else, show the -ve sign
- lblEquation.Caption := 'The equation is: ' + boxa + edtAvalue.text + 'x² ' + //for lblEquation print : 'The Equation is: (+/- edtAvalue)x² (+/- edtBvalue)x (+/- edtCvalue)
- boxb + edtBvalue.text + 'x ' + boxc + edtCvalue.text + '';
- end;
- procedure TfrmMainMenu.edtAvalueClick(Sender: TObject);
- begin
- edtAvalue.SelectAll; //select all of the contents of edtAvalue
- end;
- procedure TfrmMainMenu.edtBvalueChange(Sender: TObject);
- var
- boxa, boxb, boxc: string;
- begin
- boxa := cboxA.text; //set the variable boxa the same as the text in CboxA
- if (boxa = '+') then //if the sign in CboxA is '+' then
- boxa := '' //set boxa as blank ''
- else
- boxa := cboxA.text; //else, show the -ve sign
- boxb := cboxB.text; //set the variable boxb the same as the text in CboxB
- if (boxb = '+') then //if the sign in CboxB is '+' then
- boxb := '' //set boxb as blank ''
- else
- boxb := cboxB.text; //else, show the -ve sign
- boxc := cboxC.text; //set the variable boxc the same as the text in CboxC
- if (boxc = '+') then //if the sign in CboxC is '+' then
- boxc := '' //set boxc as blank ''
- else
- boxc := cboxC.text; //else, show the -ve sign
- lblEquation.Caption := 'The equation is: ' + boxa + edtAvalue.text + 'x² ' + //for lblEquation print : 'The Equation is: (+/- edtAvalue)x² (+/- edtBvalue)x (+/- edtCvalue)
- boxb + edtBvalue.text + 'x ' + boxc + edtCvalue.text + '';
- end;
- procedure TfrmMainMenu.edtBvalueClick(Sender: TObject);
- begin
- edtBvalue.SelectAll; //select all of the contents of edtAvalue
- end;
- procedure TfrmMainMenu.edtCvalueChange(Sender: TObject);
- var
- boxa, boxb, boxc: string;
- begin
- boxa := cboxA.text; //set the variable boxa the same as the text in CboxA
- if (boxa = '+') then //if the sign in CboxA is '+' then
- boxa := '' //set boxa as blank ''
- else
- boxa := cboxA.text; //else, show the -ve sign
- boxb := cboxB.text; //set the variable boxb the same as the text in CboxB
- if (boxb = '+') then //if the sign in CboxB is '+' then
- boxb := '' //set boxb as blank ''
- else
- boxb := cboxB.text; //else, show the -ve sign
- boxc := cboxC.text; //set the variable boxc the same as the text in CboxC
- if (boxc = '+') then //if the sign in CboxC is '+' then
- boxc := '' //set boxc as blank ''
- else
- boxc := cboxC.text; //else, show the -ve sign
- lblEquation.Caption := 'The equation is: ' + boxa + edtAvalue.text + 'x² ' + //for lblEquation print : 'The Equation is: (+/- edtAvalue)x² (+/- edtBvalue)x (+/- edtCvalue)
- boxb + edtBvalue.text + 'x ' + boxc + edtCvalue.text + '';
- end;
- procedure TfrmMainMenu.edtCvalueClick(Sender: TObject);
- begin
- edtCvalue.SelectAll; //select all of the contents of edtAvalue
- end;
- procedure TfrmMainMenu.FormCreate(Sender: TObject);
- begin //when then the program is opened
- frmMainMenu.Width := 292; //set the width to 292
- frmMainMenu.Height := 401; //set the height to 401
- btnProduce_Solution.Hide; //hide all with .hide
- btnProduce_Graph.Hide;
- cboxA.Hide;
- cboxB.Hide;
- cboxC.Hide;
- edtAvalue.Hide;
- edtBvalue.Hide;
- edtCvalue.Hide;
- imgFormula.Hide;
- lbla.Hide;
- lblb.Hide;
- lblc.Hide;
- lblEnterValues.Hide;
- lblEquation.Hide;
- lblQuadraticEquationProgram.Hide;
- LoginButton.Show; //show all with .show
- edtUsername.Show;
- edtPassword.Show;
- SignUpButton.Show;
- Label1.Show;
- Label2.Show;
- end;
- procedure TfrmMainMenu.LoginButtonClick(Sender: TObject); //Procedure to let the user into the program
- var
- UserName1, Password1: string; //variables Username1 and Password1
- found, done: boolean;
- begin
- AssignFile(UserFile, 'UserNames.txt'); //assign the UserFile to the text file Usernames.txt
- Reset(UserFile); //when button is pressed, reset the UserFile
- Done := False;
- UserName1 := edtUsername.text; //set Username1 to the contents of edtUsername
- Password1 := edtPassword.text; //set Password1 to the contents of edtPassword
- while ((Done = False) AND (EOF(UserFile) = False)) do //while both done=false and end.of.file+false do
- begin
- readln(UserFile, TextString); //read the UserFile
- if (TextString = UserName1) then //if the first textstring is the same as Username1 then
- begin
- readln(UserFile, TextString); //read the UserFile
- if (TextString = Password1) then //if the first textstring is the same as Password then
- begin
- frmMainMenu.Width := 488; //set width as 488
- frmMainMenu.Height := 385; //set height as 385
- btnProduce_Solution.Show; //from procedure TfrmMainMenu.FormCreate(Sender: TObject)
- btnProduce_Graph.Show; //show the Produce_Graph form
- cboxA.Show; //show all with .show
- cboxB.Show;
- cboxC.Show;
- edtAvalue.Show;
- edtBvalue.Show;
- edtCvalue.Show;
- imgFormula.Show;
- lbla.Show;
- lblb.Show;
- lblc.Show;
- lblEnterValues.Show;
- lblEquation.Show;
- lblQuadraticEquationProgram.Show;
- LoginButton.Hide; //hide all with .hide
- edtUsername.Hide;
- edtPassword.Hide;
- SignUpButton.Hide;
- lblQE.Hide;
- lblP.Hide;
- Label1.Hide;
- Label2.Hide;
- Done := true;
- end;
- end;
- if ((eof(UserFile)= true) AND (Done = false)) then //if the End.Of.File has been reached and done=false
- begin //
- showmessage('Incorrect Username or Password');
- end;
- end;
- closefile(UserFile);
- end;
- procedure TfrmMainMenu.SignUpButtonClick(Sender: TObject);
- begin
- SignUpPG.frmSignUp_Page.Show; //Shows the SignUp Page
- frmSignUp_Page.edtName.Clear; //Clears the edtNAme box
- frmSignUp_Page.edtPassword.Clear; //CLears the edtPassword box
- frmSignUp_Page.edtComfPassword.Clear; //Clears the edtComfPassword box
- end;
- procedure TfrmMainMenu.btnProduce_GraphClick(Sender: TObject);
- begin
- frmProduce_Graph.Show; //shows the Produce_Graph form
- end;
- procedure TfrmMainMenu.btnProduce_SolutionClick(Sender: TObject);
- var
- boxa, boxb, boxc: string; //declares the variable boxa, boxb and boxc
- begin //
- frmProduce_Solutions.Show; //shows the Produce_Solutions form
- boxa := cboxA.text; //sets the variable boxa to the text of CboxA
- if (boxa = '+') then //if the sign of CboxA is a '+' then
- frmProduce_Solutions.lblEquationIs.Caption := edtAvalue.text //in the form Produce_Solutions print out the text that is in edtAvalue
- else
- frmProduce_Solutions.lblEquationIs.Caption := cboxA.text + edtAvalue.text; //else, if the sign is a '-' then print the -ve sign with what is in the edtAvalue box
- begin
- frmProduce_Solutions.lbl_aIs.Caption := cboxA.text + edtAvalue.text + ''; //in the form Produce_Solutions print the text of CboxA and edtAvalue to the label lbl_aIs
- frmProduce_Graph.lblPG_a.Caption := cboxA.text + edtAvalue.text + ''; //in the form Produce_Graph prin the text of CboxA and edtAvalue to the label lblPG_a
- end;
- boxb := cboxB.text; //sets the variable boxa to the text of CboxB
- if (boxb = '+') then //if the sign of CboxB is a '+' then
- frmProduce_Solutions.lblEquationIs.Caption := edtBvalue.text //in the form Produce_Solutions print out the text that is in edtBvalue
- else
- frmProduce_Solutions.lblEquationIs.Caption := cboxB.text + edtBvalue.text; //else, if the sign is a '-' then print the -ve sign with what is in the edtBvalue box
- begin
- frmProduce_Solutions.lbl_bIs.Caption := cboxB.text + edtBvalue.text + ''; //in the form Produce_Solutions print the text of CboxB and edtBvalue to the label lbl_bIs
- frmProduce_Graph.lblPG_b.Caption := cboxB.text + edtBvalue.text + ''; //in the form Produce_Graph prin the text of CboxB and edtBvalue to the label lblPG_b
- end;
- boxc := cboxC.text; //sets the variable boxa to the text of CboxC
- if (boxc = '+') then //if the sign of CboxC is a '+' then
- frmProduce_Solutions.lblEquationIs.Caption := edtCvalue.text //in the form Produce_Solutions print out the text that is in edtCvalue
- else
- frmProduce_Solutions.lblEquationIs.Caption := cboxC.text + edtCvalue.text; //else, if the sign is a '-' then print the -ve sign with what is in the edtCvalue box
- begin
- frmProduce_Solutions.lbl_cIs.Caption := cboxC.text + edtCvalue.text + ''; //in the form Produce_Solutions print the text of CboxC and edtCvalue to the label lbl_cIs
- frmProduce_Graph.lblPG_c.Caption := cboxC.text + edtCvalue.text + ''; //in the form Produce_Graph prin the text of CboxC and edtCvalue to the label lblPG_c
- end;
- begin
- frmProduce_Solutions.lblEquationIs.Caption := lblEquation.Caption; //set lblEquationIs in Produce_Solutions the same as lblEquation
- frmProduce_Graph.lblPG_Eq.Caption := lblEquation.Caption; //set lblPG_Eq in Produce_Graph the same as lblEquation
- end;
- end;
- procedure TfrmMainMenu.cboxAChange(Sender: TObject);
- var
- boxa, boxb, boxc: string;
- begin
- boxa := cboxA.text;
- if (boxa = '+') then
- boxa := ''
- else
- boxa := cboxA.text;
- boxb := cboxB.text;
- if (boxb = '+') then
- boxb := cboxB.text;
- boxc := cboxC.text;
- if (boxc = '+') then
- boxc := cboxC.text;
- lblEquation.Caption := 'The equation is: ' + boxa + edtAvalue.text + 'x² ' +
- boxb + edtBvalue.text + 'x ' + boxc + edtCvalue.text + '';
- end;
- procedure TfrmMainMenu.cboxBChange(Sender: TObject);
- var
- boxa, boxb, boxc: string;
- begin
- boxa := cboxA.text;
- if (boxa = '+') then
- boxa := ''
- else
- boxa := cboxA.text;
- boxb := cboxB.text;
- if (boxb = '+') then
- boxb := cboxB.text;
- boxc := cboxC.text;
- if (boxc = '+') then
- boxc := cboxC.text;
- lblEquation.Caption := 'The equation is: ' + boxa + edtAvalue.text + 'x² ' +
- boxb + edtBvalue.text + 'x ' + boxc + edtCvalue.text + '';
- end;
- procedure TfrmMainMenu.cboxCChange(Sender: TObject);
- var
- boxa, boxb, boxc: string;
- begin
- boxa := cboxA.text;
- if (boxa = '+') then
- boxa := ''
- else
- boxa := cboxA.text;
- boxb := cboxB.text;
- if (boxb = '+') then
- boxb := cboxB.text;
- boxc := cboxC.text;
- if (boxc = '+') then
- boxc := cboxC.text;
- lblEquation.Caption := 'The equation is: ' + boxa + edtAvalue.text + 'x² ' +
- boxb + edtBvalue.text + ' x ' + boxc + edtCvalue.text + '';
- end;
- procedure TfrmMainMenu.edtUsernameClick(Sender: TObject);
- begin
- edtUsername.SelectAll;
- end;
- procedure TfrmMainMenu.edtPasswordClick(Sender: TObject);
- begin
- edtPassword.SelectAll;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement