* * *

Author Topic: Lazarus  (Read 1349 times)

Artem

  • New member
  • *
  • Posts: 15
Lazarus
« on: November 12, 2016, 03:22:44 pm »
How can I fix my code? The lazarus says: 
Compile Project, Target: test.exe: Exit code 1, Errors: 1
Fatal: Syntax error, "BEGIN" expected but "end of file" found
what should i do?
I attached file also)
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
  StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Button8: TButton;
    Button9: TButton;
    CheckGroup1: TCheckGroup;
    CheckGroup2: TCheckGroup;
    CheckGroup3: TCheckGroup;
    CheckGroup4: TCheckGroup;
    Label10: TLabel;
    Label12: TLabel;
    Label14: TLabel;
    Label2: TLabel;
    Label4: TLabel;
    Label6: TLabel;
    Label8: TLabel;
    Memo1: TMemo;
    RadioGroup1: TRadioGroup;
    RadioGroup2: TRadioGroup;
    RadioGroup3: TRadioGroup;
    procedure Button1Click(Sender: TObject);
    procedure result(k:integer);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Button8Click(Sender: TObject);
    procedure Button9Click(Sender: TObject);



  private
    { private declarations }
  public
    { public declarations }
  end;

  var
  Form1: TForm1;
  k,j:integer;


implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
Filename:string;
begin
Filename:=Application.ExeName;
Close;
WinExec(PChar(FileName),SW_SHOW);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
  Close;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  Button3.Enabled:= False;
  if (CheckGroup1.Checked[3])or (checkGroup1.checked[1])
  and not (CheckGroup1.Checked[0])
  and not   (CheckGroup1.Checked[2])
  and not (CheckGroup1.Checked [4])
  then begin
    label2.visible:=true;
  label2.caption:='Подумай ещё.' + #10#13 +'Ты на верном пути';
  end
    else
  If (CheckGroup1.Checked[0]) or
  Not(CheckGroup1.Checked[1]) or
  (CheckGroup1.Checked[2])or
  not (CheckGroup1.Checked[3])or
  (CheckGroup1.Checked[4])
  then
  begin
  Label2.vISIBLE:=True;
  Label2.Caption:='Неправильно!';
            end
     else
     if (CheckGroup1.Checked[3])and(CheckGroup1.Checked[1])
     then
     begin
     Label2.Visible:=True;
     Label2.CAPtion:='Верно!';
     k:=k+1;
     j:=j+1;
     if j=7 then memo1.visible:=true;
end;

end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  Button4.Enabled:=False;
  If RadioGroup1.ItemIndex=0
  then Begin
    Label4.Visible:=True ;
    Label4.Caption:='Правильно';
     k:=k+1;
     j:=j+1;
     if j=7 then memo1.visible:=true;
    end
  else
  Begin
    Label4.Visible:=True ;
    Label4.Caption:='Неправильно';
    end;

  end;

procedure TForm1.Button5Click(Sender: TObject);
begin
   Button5.Enabled:=False;
  If RadioGroup3.ItemIndex=1
  then Begin
    Label6.Visible:=True ;
    Label6.Caption:='Правильно';
     k:=k+1;
     j:=j+1;
     if j=7 then memo1.visible:=true;
    end
  else
  Begin
    Label6.Visible:=True ;
    Label6.Caption:='Неправльно';

    end;
end;

procedure TForm1.Button6Click(Sender: TObject);

  begin
  Button6.Enabled:=False;
  If (CheckGroup2.Checked[0])or
  (CheckGroup2.Checked[1])
  and not (CheckGroup2.Checked[2])
  and not (CheckGroup2.Checked[3])
        then
  begin
    Label8.Visible:=True;
    Label8.Caption:= 'Подумай ещё' + #10#13 + 'Ты на правильном пути';

  end
  else
  if (CheckGroup2.Checked[2])
  or not (CheckGroup2.Checked[0])
  or not (CheckGroup2.Checked[1])
  or (CheckGroup2.Checked[3])
  then
  begin
    Label8.Visible:=True;
    Label8.Caption:='Неправильно';

    end
else
If  (CheckGroup2.Checked[0])and(CheckGroup3.Checked[1])
then
begin
   Label8.Visible:=True;
   Label8.Caption:='Верно';
    k:=k+1;
    j:=j+1;
     if j=7 then memo1.visible:=true;
end;
end;

procedure TForm1.Button7Click(Sender: TObject);
   begin
  Button7.enabled:=false;
  If RadioGroup2.ItemIndex= 0
  then begin
    Label10.Visible:=True;
    Label10.Caption:='Правильно';
     k:=k+1;
     j:=j+1;
     if j=7 then memo1.visible:=true;
  end
  else
  begin
    Label10.Visible:=True;
    Label10.Caption:='Неправильно';

  end;
end;

procedure TForm1.Button8Click(Sender: TObject);

  begin
  Button8.Enabled:=False;
  If (CheckGroup3.Checked[1])or
  (CheckGroup3.Checked[2])
  and not (CheckGroup3.Checked[0])
  and not (CheckGroup3.Checked[3])
        then
  begin
    Label12.Visible:=True;
    Label12.Caption:='Подумай ещё!' + #10#13 + 'Ты на верном пути!';

  end
  else
  if (CheckGroup3.Checked[0])
  or not (CheckGroup3.Checked[1])
  or not (CheckGroup3.Checked[2])
  or (CheckGroup3.Checked[3])
  then
  begin
    Label12.Visible:=True;
    Label12.Caption:='Неправильно';

    end
else
If  (CheckGroup3.Checked[1])and(CheckGroup3.Checked[2])
then
begin
   Label12.Visible:=True;
   Label12.Caption:='Верно';
    k:=k+1; j:=j+1;
     if j=7 then memo1.visible:=true;
end;
  end;

procedure TForm1.Button9Click(Sender: TObject);

  begin
  Button9.Enabled:=False;
  If (CheckGroup4.Checked[0])
  or (CheckGroup4.Checked[3])
  and not (CheckGroup4.Checked[1])
  and not (CheckGroup4.Checked[2])
  then
  begin
     Label14.Visible:=True;
     Label14.Caption:='Подумай ещё.Ты на верном пути!';

  end
  else if (CheckGroup4.Checked[1])or not
  (CheckGroup4.Checked[0])
  or not(CheckGroup4.Checked[3])
  or (CheckGroup4.Checked[2])
  then
  begin
     Label14.Visible:=True;
     Label14.Caption:='Неправильно';

     end
  else if
  (CheckGroup4.Checked[0])and(CheckGroup4.Checked[3])
  then
  begin
     Label14.Visible:=True;
     Label14.Caption:='Верно';
      k:=k+1;j:=j+1;
     if j=7 then memo1.visible:=true;
   end;

end;
  procedure TForm1.result(k);
begin
     Memo1.text:= 'Всего вопросов - 5'+#10#13+'Правильных ответов - '+inttostr(k)
     + #10#13 +'Процент правильных ответов - '+strtofloat(k/7*100) +#10#13+'Оценка - '
     +    case k of
                 0..2: '1';
                 3: '2';
                 4: '3';
                 5,6:'4';
                 7:'5';
         end;
end;

end.
« Last Edit: November 12, 2016, 04:53:09 pm by Artem »

Bart

  • Hero Member
  • *****
  • Posts: 2655
    • Bart en Mariska's Webstek
Re: Lazarus
« Reply #1 on: November 12, 2016, 03:24:47 pm »
Without the actual code, how could we possibly tell?

Attach the project (zipped sources) here.

Bart

Artem

  • New member
  • *
  • Posts: 15
Re: Lazarus
« Reply #2 on: November 12, 2016, 03:41:45 pm »
I attached my code here, because I couldn't  find way to attach any files.

wp

  • Hero Member
  • *****
  • Posts: 3451
Re: Lazarus
« Reply #3 on: November 12, 2016, 03:46:29 pm »
Underneath the box into which you type your text there an "Attachments and other options"
Lazarus trunk / fpc 3.0.0 / Win32

Artem

  • New member
  • *
  • Posts: 15
Re: Lazarus
« Reply #4 on: November 12, 2016, 03:54:55 pm »
I tried to upload zipped file of my cose but it says that my file is too big((

molly

  • Hero Member
  • *****
  • Posts: 1566
Re: Lazarus
« Reply #5 on: November 12, 2016, 04:06:21 pm »
I tried to upload zipped file of my cose but it says that my file is too big((
- start lazarus
- open your project (if not already open)
- from project menu select publish project
- select a directory where you want to place the published files
- Press ok

Zip up that directory, and attach it to you post.

I doubt that your project contains so many sources that they will not fit when zipped. Most likely you also added object files and the produced executable file ?

Artem

  • New member
  • *
  • Posts: 15
Re: Lazarus
« Reply #6 on: November 12, 2016, 04:11:13 pm »
Yes, I added object files also :D it all seems like I'm stupid
I did as you said but nothing did't happen, I clicked and then was waiting, clicked and then was waiting, I did it for four times, but nothing did't happend((
« Last Edit: November 12, 2016, 04:31:16 pm by Artem »

molly

  • Hero Member
  • *****
  • Posts: 1566
Re: Lazarus
« Reply #7 on: November 12, 2016, 04:20:11 pm »
it all seems like I'm stupid
Stupid ? No, not really.

Simply new to the subject (also referred to as someone being a newbie). No problem there, as we all have to start somewhere.  :)

Artem

  • New member
  • *
  • Posts: 15
Re: Lazarus
« Reply #8 on: November 12, 2016, 04:34:10 pm »
Oh, thanks for this)) But I did all that you said, why did nothing happen? I'm really sorry that I even can't do that  :-\

lainz

  • Hero Member
  • *****
  • Posts: 1841
  • Nace una flor, todos los días sale el sol...
    • BGRABitmap
Re: Lazarus
« Reply #9 on: November 12, 2016, 04:47:29 pm »
Oh, thanks for this)) But I did all that you said, why did nothing happen? I'm really sorry that I even can't do that  :-\

Project > Publish project > where it says 'Destination directory' change it to $(ProjPath)\published\

It will create a new folder in the directory of your project called published, just zip that folder and upload it here.

Artem

  • New member
  • *
  • Posts: 15
Re: Lazarus
« Reply #10 on: November 12, 2016, 04:52:21 pm »
So you are welcome, please check it out))

lainz

  • Hero Member
  • *****
  • Posts: 1841
  • Nace una flor, todos los días sale el sol...
    • BGRABitmap
Re: Lazarus
« Reply #11 on: November 12, 2016, 04:57:42 pm »
The problem is you have the .lpr file empty!

That file contains the code that starts your program.

Edit that file and paste this code:

Code: Pascal  [Select]
  1. program test;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.   {$IFDEF UNIX}{$IFDEF UseCThreads}
  7.   cthreads,
  8.   {$ENDIF}{$ENDIF}
  9.   Interfaces, // this includes the LCL widgetset
  10.   Forms, unit1
  11.   { you can add units after this };
  12.  
  13. {$R *.res}
  14.  
  15. begin
  16.   RequireDerivedFormResource:=True;
  17.   Application.Initialize;
  18.   Application.CreateForm(TForm1, Form1);
  19.   Application.Run;
  20. end.  

Then you need to solve the other errors.

Artem

  • New member
  • *
  • Posts: 15
Re: Lazarus
« Reply #12 on: November 12, 2016, 05:00:07 pm »
Oooh, finally, thank you a lot and thanks to to everybody who helped me also :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus