Kółko i krzyżyk

0

Mój problem polega na tym że kompilator wypisuje błędy :
[Error] ust.pas(49): Undeclared identifier: 'X33'
[Error] ust.pas(51): Undeclared identifier: 'X44'
[Error] ust.pas(60): Undeclared identifier: 'HVH'
[Error] ust.pas(68): Statement expected but end of file found
[Error] ust.pas(26): Unsatisfied forward or external declaration: 'TUst_Form.GetRozmiarp'
[Error] ust.pas(27): Unsatisfied forward or external declaration: 'TUst_Form.GetPrzeciwnicy'
do tego kodu,

unit ust;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TUst_Form = class(TForm)
    Button1: TButton;
    Button2: TButton;
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;

    procedure Button2Click(Sender: TObject);

  private
    { Private declarations }
  public
    X33: TRadioButton;
    X44: TRadioButton;
    X55: TRadioButton;
    HVH: TRadioButton;
    HVC: TRadioButton;
    function GetRozmiarp : integer;
    function GetPrzeciwnicy : integer;
  end;

var
  Ust_Form: TUst_Form;
  rozmiarp: integer;
  przeciwnicy: integer;
implementation

{$R *.dfm}

procedure TUst_Form.Button2Click(Sender: TObject);
begin
 X55.Checked:=True;
 X44.Checked:=False;
 X33.Checked:=False;
 HVH.Checked:=True;
 HVC.Checked:=False;
end;

function GetRozmiarp: integer;
Begin
    if X33.Checked=true then
      GetRozmiarp:=3
    else if X44.Checked=true then
      GetRozmiarp:=4
    else
      GetRozmiarp:=5;

End;

function GetPrzeciwnicy : integer;
begin
     if HVH.Checked=True then
        GetPrzeciwnicy:=1
     else
        GetPrzeciwnicy:=2;
End;

główna część kodu

unit main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, StdCtrls;

type
  TMainForm = class(TForm)
    tytul: TLabel;
    b1_st: TButton;
    b1_us: TButton;
    b1_ko: TButton;
    b1_ab: TButton;
    tworca: TLabel;
    plansza: TStringGrid;
    player1: TLabel;
    player2: TLabel;
    vs: TLabel;
    Lrw1: TLabel;
    Lrw2: TLabel;
    p1z: TLabel;
    Label3: TLabel;
    procedure b1_usClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure b1_stClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  MainForm: TMainForm;
  biezacaFigura : integer; // 1 - X, 2 - O
  rozpoczecie: integer;
  player1 : integer; // 1 - czlowiek, 2 - komputer
  player2 : integer; // 1 - czlowiek, 2 - komputer
  rozmiarp: integer; // rozmiar planszy
  przeciwnicy: integer; // przeciwnicy: 1 - czlowiek vs czlowiek;  2 - czlowiek vs komputer

implementation

uses ust;
{$R *.dfm}

procedure TMainForm.b1_usClick(Sender: TObject);
begin
  Ust_Form:= TUst_Form.Create(Application);
  Ust_Form.ShowModal;
  rozmiarp:=Ust_Form.GetRozmiarp;
  przeciwnicy:=Ust_Form.GetPrzeciwnicy;
  Ust_Form.Free;
end;
0

chodzi Ci o te funkcje (trzy pierwsze bledy) ?

function GetRozmiarp: integer;
Begin
    if X33.Checked=true then
      GetRozmiarp:=3
    else if X44.Checked=true then
      GetRozmiarp:=4
    else
      GetRozmiarp:=5;

End;

function GetPrzeciwnicy : integer;
begin
     if HVH.Checked=True then
        GetPrzeciwnicy:=1
     else
        GetPrzeciwnicy:=2;
End;

To nie sa metody klasy TUst_form, dlatego nie widzisz w tych funkcjach pol, np X33.

0

Może podam gotowy kod:

function TMainForm.GetRozmiarp: integer;
Begin
    if X33.Checked=true then
      GetRozmiarp:=3
    else if X44.Checked=true then
      GetRozmiarp:=4
    else
      GetRozmiarp:=5;

End;

function TMainForm.GetPrzeciwnicy : integer;
begin
     if HVH.Checked=True then
        GetPrzeciwnicy:=1
     else
        GetPrzeciwnicy:=2;
End;

1 użytkowników online, w tym zalogowanych: 0, gości: 1