Thema: Delphi Konstantenobjekt ?

Einzelnen Beitrag anzeigen

Lotus

Registriert seit: 26. Feb 2007
85 Beiträge
 
Delphi 7 Personal
 
#8

Re: Globale Variable greift nicht zu?

  Alt 26. Jun 2007, 18:52
nein, e1 ist ein Edit fehlt, da gibts keine captions.. daran liegts leider nicht..

Hier vllt noch mal den gesammten Code
Delphi-Quellcode:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    e1: TEdit;
    e2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button2: TButton;
    Label3: TLabel;
    anzahl: TLabel;
    wort: TLabel;
    Button3: TButton;
    procedure Button3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  wort:string;
  merker:integer;

implementation

{$R *.dfm}

procedure TForm1.Button3Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
wort:=e1.Text;
Button1.Enabled:=false;
Button2.Enabled:=true;
e1.Text:='########';
e1.Enabled:=false;
e2.Enabled:=true;

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
wort:='';
merker:=0;
end;

procedure TForm1.Button2Click(Sender: TObject);
var wort2:string;
begin
inc(merker);
showmessage(inttostr(merker));
wort2:=e2.Text;
showmessage(wort);
showmessage(wort2);
end;

end.
und die dfm
Delphi-Quellcode:
object Form1: TForm1
  Left = 188
  Top = 21
  Width = 786
  Height = 541
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 32
    Top = 32
    Width = 38
    Height = 13
    Caption = 'Player 1'
  end
  object Label2: TLabel
    Left = 32
    Top = 64
    Width = 38
    Height = 13
    Caption = 'Player 2'
  end
  object Label3: TLabel
    Left = 16
    Top = 112
    Width = 35
    Height = 13
    Caption = 'Anzahl:'
  end
  object anzahl: TLabel
    Left = 72
    Top = 112
    Width = 3
    Height = 13
  end
  object wort: TLabel
    Left = 360
    Top = 64
    Width = 3
    Height = 13
  end
  object e1: TEdit
    Left = 96
    Top = 32
    Width = 121
    Height = 21
    TabOrder = 0
  end
  object e2: TEdit
    Left = 96
    Top = 64
    Width = 121
    Height = 21
    Enabled = False
    TabOrder = 1
  end
  object Button1: TButton
    Left = 232
    Top = 32
    Width = 89
    Height = 25
    Caption = 'Wort speichern'
    TabOrder = 2
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 232
    Top = 64
    Width = 89
    Height = 25
    Caption = 'Wort erraten'
    Enabled = False
    TabOrder = 3
    OnClick = Button2Click
  end
  object Button3: TButton
    Left = 528
    Top = 304
    Width = 75
    Height = 25
    Caption = 'Beenden'
    TabOrder = 4
    OnClick = Button3Click
  end
end
  Mit Zitat antworten Zitat