Autor Beitrag
somebody
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167
Erhaltene Danke: 2



BeitragVerfasst: So 06.05.07 18:00 
Hi, Leutz

Ich wollte mal son rechen programm machen und ich bin soweit auch fertig, nur ich weiß nicht, wie man die aufgaben zwischen +,-,* wechselt und das das eine editfeld grün wird wenn es richtig ist und es rot wird wenn es falsch ist und ein kommentar dazu steh, also ob es falsch oder richtig ist. Wie man das mit plus minus oder mal macht weiß ich, und alles andere auch, aber nicht wie das dazwischen welchselt, also das der sich das aussucht wenn man auf einen button drückt. bisher steht das hier
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Panel2: TPanel;
    Panel4: TPanel;
    Edit1: TEdit;
    Panel5: TPanel;
    Button2: TButton;
    Edit2: TEdit;
    Edit3: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  zahl2 : integer;
  zahl1 : integer;
  aufgabenart : integer;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
     zahl1 := random(10);
     zahl2 := random(10);
     edit1.text := inttostr(zahl1);
     edit2.text := inttostr(zahl2);
     edit3.color := clwhite;
     edit3.text := '';

     panel2.caption := '+';

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
     randomize;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
              if
                edit3.text = inttostr(zahl1+zahl2)
          then
              begin
                   panel5.caption := 'Richtig';
                   edit3.color := cllime;
              end
          else
              begin
                   panel5.caption := 'Falsch';
                   edit3.color := clred;
              end;
end;

end.


also wie macht man das?

mfg:somebody
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 06.05.07 18:43 
Moin!

user profile iconsomebody hat folgendes geschrieben:
also wie macht man das?

Schau mal hier, da steht alles Wichtige für dich drin. :|

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
somebody Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 167
Erhaltene Danke: 2



BeitragVerfasst: So 06.05.07 18:53 
So richtig hilft das net. Weiß sonst jemand wie man das macht?
ConditionZero
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win XP
Delphi 7 PE, C++ (Dev-C++), HTML+PHP (Dreamweaver MX), JavaScript(MS FrontPage)
BeitragVerfasst: So 06.05.07 19:20 
Moin,

machst für jede Rechenart ein Panel, welches du in Button1Click sichtbar machst und alle anderen unsichtbar macht. Diese tust du alle aufeinander und am Anfang Visible:= false; stellen.

Zu dem auf rot und grün schalten:

[delphi]
begin
if Aufgabe = Richtig then Label1.Color:= clGreen
else Label1.Color:= clRed;
end;

[/delphi]

LG
Marc

//Edit: Oo wieso wird das in Tags gesetze nicht als Quellcode angezeigt?