| Autor |
Beitrag |
somebody
      
Beiträge: 167
Erhaltene Danke: 2
|
Verfasst: Fr 09.02.07 10:46
Ich hab mal sonne Frage, ich kenne mich mit delphi noch nicht so sehr dolle aus, und ich wollte mal fragen was ich falsch mache, ich wollte nämlich für meinen kleinen Bruder ein Vokabelprogramm versuchen, wo angezeigt wird ob er die Vokabel richtig hat.
Ich hab geschrieben:
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: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121:
| unit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, Grids, ComCtrls, ColorGrd;
type TForm1 = class(TForm) Edit2: TEdit; Shape1: TShape; Edit5: TEdit; Edit6: TEdit; Edit8: TEdit; Edit10: TEdit; Edit1: TEdit; Edit3: TEdit; Edit4: TEdit; Edit7: TEdit; Edit9: TEdit; Edit11: TEdit; Edit12: TEdit; Edit13: TEdit; Edit14: TEdit; Edit15: TEdit; Edit16: TEdit; Edit17: TEdit; Edit19: TEdit; Edit20: TEdit; Edit21: TEdit; Edit22: TEdit; Edit18: TEdit; Edit23: TEdit; Edit24: TEdit; Edit25: TEdit; StaticText1: TStaticText; StaticText2: TStaticText; StaticText3: TStaticText; StaticText4: TStaticText; StaticText5: TStaticText; StaticText6: TStaticText; StaticText7: TStaticText; StaticText8: TStaticText; StaticText9: TStaticText; StaticText10: TStaticText; StaticText11: TStaticText; StaticText12: TStaticText; StaticText13: TStaticText; StaticText14: TStaticText; StaticText15: TStaticText; StaticText16: TStaticText; StaticText17: TStaticText; StaticText18: TStaticText; StaticText19: TStaticText; StaticText20: TStaticText; StaticText21: TStaticText; StaticText22: TStaticText; StaticText23: TStaticText; StaticText24: TStaticText; StaticText25: TStaticText; Button1: TButton; Edit26: TEdit; Edit27: TEdit; Edit28: TEdit; Edit31: TEdit; StaticText26: TStaticText; StaticText28: TStaticText; StaticText29: TStaticText; StaticText31: TStaticText; Shape2: TShape; Shape3: TShape; Shape4: TShape; Shape5: TShape; Shape6: TShape; Shape7: TShape; Shape8: TShape; Shape9: TShape; Shape10: TShape; Shape11: TShape; Shape12: TShape; Shape13: TShape; Shape14: TShape; Shape15: TShape; Shape16: TShape; Shape17: TShape; Shape18: TShape; Shape19: TShape; Shape20: TShape; Shape21: TShape; Shape22: TShape; Shape23: TShape; Shape24: TShape; Shape25: TShape; Shape26: TShape; Shape27: TShape; Shape28: TShape; Shape29: TShape; Shape30: TShape; procedure Button1Click(Sender: TObject); private public end;
var Form1: TForm1; implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject); begin if edit2.text :='trouble' then shape2.brush.color :=clgreen end;
end. |
und dann makiert delphi then rot. Was mache ich falsch?
Danke jetzt schon mal für hilfen.
Moderiert von gausi: Delphi-Tags hinzugefügt.
|
|
basti_1984
      
Beiträge: 104
Linux, Win Xp, Win 2000
Delphi, C, C++, PHP,
|
Verfasst: Fr 09.02.07 10:49
Versuchs mal so
Delphi-Quelltext 1: 2:
| if edit2.text :='trouble' then shape2.brush.color :=clgreen |
oder
Delphi-Quelltext 1: 2:
| if (edit2.text :='trouble') then shape2.brush.color :=clgreen |
ist auch etwas übersichtlicher
_________________ Wissen ist Macht. Nichts zu Wissen macht auch nichts
|
|
basti_1984
      
Beiträge: 104
Linux, Win Xp, Win 2000
Delphi, C, C++, PHP,
|
Verfasst: Fr 09.02.07 10:50
Blödsinn. ICh ahbe den Fehler gefunden
:= ist eine Zuweisung
du willst aber =
also
Delphi-Quelltext 1: 2:
| if edit2.text ='trouble' then shape2.brush.color :=clgreen |
_________________ Wissen ist Macht. Nichts zu Wissen macht auch nichts
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Fr 09.02.07 10:50
Delphi-Quelltext 1: 2:
| if (edit2.text = 'trouble') then shape2.brush.color :=clgreen; |
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
somebody 
      
Beiträge: 167
Erhaltene Danke: 2
|
Verfasst: Fr 09.02.07 10:55
Ah, danke für die vielen hilfen, jetzt geht es jetzt kommt aber das nächste Problem, wie mache ich das öfters?
Ich hab da:
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
| procedure TForm1.Button1Click(Sender: TObject); begin if edit2.text ='trouble' then shape23.brush.color :=clgreen
if edit10.text ='conference' then shape2.brush.color :=clgreen end;
end. |
und es geht nicht.
Moderiert von Gausi: Delphi-Tags hinzugefügt.
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Fr 09.02.07 11:04
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
| procedure TForm1.Button1Click(Sender: TObject); begin if edit2.text ='trouble' then shape23.brush.color :=clgreen; if edit10.text ='conference' then shape2.brush.color :=clgreen end;
end. |
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
somebody 
      
Beiträge: 167
Erhaltene Danke: 2
|
Verfasst: Fr 09.02.07 11:05
ah, danke ich probier es mal aus
Zuletzt bearbeitet von somebody am Fr 09.02.07 11:06, insgesamt 1-mal bearbeitet
|
|
basti_1984
      
Beiträge: 104
Linux, Win Xp, Win 2000
Delphi, C, C++, PHP,
|
Verfasst: Fr 09.02.07 11:05
Ich würde dir empfehlen dei Syntax von Delphi dir anzusehen.
_________________ Wissen ist Macht. Nichts zu Wissen macht auch nichts
|
|
somebody 
      
Beiträge: 167
Erhaltene Danke: 2
|
Verfasst: Fr 09.02.07 11:08
jaaaaaaaaaa, jetzt gehts. vielen dank für die hilfen.
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Fr 09.02.07 11:10
basti_1984 hat folgendes geschrieben: | | Ich würde dir empfehlen dei Syntax von Delphi dir anzusehen. |
Wie wär's hiermit?
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|