Autor Beitrag
Jelox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Di 22.03.05 12:00 
hi.
ich hab noch ein problem.
und zwar:


ich hab jetzt einmal ein login-formular erstellt und einmal ein oberlächen-formular.

naja jetzt möchte ich gerne im oberflächen-formular einen wert aus dem login-formular abfragen. so nun mein problem irgendwie will das ganze auch nicht
ULogin:

ULogin:
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:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
unit ULogin;  

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

 
type  
  TFLogin = class(TForm)  
    PLogin: TPanel;  
    EUsername: TEdit;  
    EPasswort: TEdit;  
    BLogin: TButton;  
    LUsername: TLabel;  
    LRein: TLabel;  
    LPasswort: TLabel;  
    BBeenden: TButton;  
    procedure BBeendenClick(Sender: TObject);  
    procedure BLoginClick(Sender: TObject);  
  private  
    { Private-Deklarationen }  
  public  
    { Public-Deklarationen }  
  end;  

 
var  
  FLogin: TFLogin;  

 
implementation  

 
uses UOberflaeche;  

 
{$R *.dfm}  

 
procedure TFLogin.BBeendenClick(Sender: TObject);  
begin  
  MessageBox('Wollen Sie das Programm wirklich beenden?''Beenden?', [MB_OKCANCEL]);  
end;  

 
procedure TFLogin.BLoginClick(Sender: TObject);  
type    
  TLoginData = record    
    Username: String;    
    Password: String;    
  end;    
const  
  LoginData: array[0..2of TLoginData = (  
    (Username : 'Bernie & Eert'; Password : '16532'),  
    (Username : 'Test'; Password : 'Pinselqäuler'),  
    (Username : 'Jelox'; Password : '')  
    );  
var  
  I: Integer;    
  CanLogin: Boolean;    
begin    
  CanLogin := False;  

 
  for I := Low(LoginData) to High(LoginData) do  
    if EUsername.Text = LoginData[I].Username then  
    begin  
      if EPasswort.Text = LoginData[I].Password then  
        CanLogin := True;  
      Break;  
    end;  

 
 if CanLogin then  
  begin  
   FLogin := TFLogin.Create(Self);  
   FOberflaeche.Show  
  end    
   else  
    LRein.Caption := 'Ungültiger Benutzername oder ungültiges Passwort!';  
end;  

 
end.




UOberflaeche:
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:
unit UOberflaeche;  

 
interface  

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

 
type  
  TFOberflaeche = class(TForm)  
    LTest: TLabel;  
    procedure FormCreate(Sender: TObject);  
  private  
    { Private-Deklarationen }  
  public  
    { Public-Deklarationen }  
  end;  

 
var  
  FOberflaeche: TFOberflaeche;  

 
implementation  

 
uses ULogin;  
{$R *.dfm}  

 
procedure TFOberflaeche.FormCreate(Sender: TObject);  
begin  
begin  
  if FLogin.EUsername.Text = 'Jelox' then  
    begin  
    LTest.Caption:= 'Hallo!';  
  end;  
end;  
end;  

 
end.


please help.
bin doch noch neu ;)
schonmal n dickes danke im vorraus :)

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Moderiert von user profile iconTino: Titel geändert.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 22.03.05 12:05 
Titel: Re: wert abfragen
user profile iconJelox hat folgendes geschrieben:
so nun mein problem irgendwie will das ganze auch nicht

Auf den ersten Blick sieht es richtigt aus.

Dein "irgendwie will das ganze auch nicht" reicht nicht zur Problemfindung. Bitte etwas genauer. Solltest du dir generell angewöhnen. Das erleichtert die Fehlersuche. :wink:
1211chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP Pro, Win 7-64bit Home
D4 Prof
BeitragVerfasst: Di 22.03.05 12:25 
Titel: 2 Forms
in form1 ist z.b ein edit

frage das aus dem form2 einfach so ab:

edit2.text:= form1.edit1.text;

dann musst du in form2 noch form1 referenzieren. uses: form1

noch fragen ?

_________________
Theorie: Alles läuft ... Praxis: Nix funzt ... Ich bin eben ein Mann der Praxis
1211chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 30

WIN XP Pro, Win 7-64bit Home
D4 Prof
BeitragVerfasst: Di 22.03.05 12:35 
Titel: Kompliziert
Warum einfach schreiben, wenns kompliziert auch geht ?

Übrigens solltest Du Deine Passwörter nicht in den Quellcode mit eincompilieren,
sondern in ner geschützten DB ablegen, kannst du dann auch mal ändern :-)

_________________
Theorie: Alles läuft ... Praxis: Nix funzt ... Ich bin eben ein Mann der Praxis
Jelox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Di 22.03.05 16:25 
also. ich hab das ganze jetzt irgendwie n bisschen kleiner bekommen.

ich zeig euch einfach mal meinen ansatz:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TF*****.TRechtTimer(Sender: TObject);
begin
  if POberflaeche.Visible = true then begin
    if EUsername = 'Jelox' then begin
      LTest.Caption:= EUsername.Text;
    end;
  end;
end;


Nun ist mein Problem aber, dass der das 'Jelox' nicht annimmt, wie kann man das umgehen, damit das richtig läuft?

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Jailbird
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 127

Windows XP Pro SP2
Delphi 7 Professional
BeitragVerfasst: Di 22.03.05 16:27 
wie wär's mit EUserName.Text = 'Jelox'
Jelox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 17



BeitragVerfasst: Di 22.03.05 16:43 
großen dank erstmal an alle.
es läuft so weit erstmal :) *freu*