Autor Beitrag
Dude566
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Do 14.08.08 17:54 
Also mein Problem ist das ich eine getätigte Eingabe in ein Edit Feld mit Sternchen versehen möchte.
Da ich aber erst seit kurzem mich mit Delphi befasse frage ich hier um Rat.

Hier der Quellcode:
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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

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

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  zahl1 := StrToInt (Edit1.text);
  zahl2 := strToInt (Edit2.Text);
  if zahl2 = zahl1 then ShowMessage ('RICHTIG!!!');
  if zahl2 < zahl1 then ShowMessage ('Die gesuchte Zahl ist größer');
  if zahl2 > zahl1 then ShowMessage ('Die gesuchte Zahl ist kleiner');
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 ShowMessage (' Danke für das Verwenden der Software!')
end;

end.


Zuletzt bearbeitet von Dude566 am Do 14.08.08 18:15, insgesamt 1-mal bearbeitet
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Do 14.08.08 18:06 
Hi,

wenn du deinen Code zwischen diese Tags setzt, dann sieht's so schön aus wie bei mir:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.PasswordChar := '*';
end;


Moderiert von user profile iconChristian S.: Beiträge zusammengefasst
Dude566 Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Do 14.08.08 18:17 
Danke für die Antwort, gibt es noch andere Möglichkeiten?
Dude566 Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Do 14.08.08 18:27 
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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

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

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
  zahl1 := StrToInt (Edit1.text);
  zahl2 := strToInt (Edit2.Text);
  if zahl2 = zahl1 then ShowMessage ('RICHTIG!!!');
  if zahl2 < zahl1 then ShowMessage ('Die gesuchte Zahl ist größer');
  if zahl2 > zahl1 then ShowMessage ('Die gesuchte Zahl ist kleiner');
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 ShowMessage (' Danke für das verwenden der Software!');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Edit1.PasswordChar := '*';
end;

end.


Es funktioniert nicht, es kommt ein Fehler, kann mir einer sagen was falsch ist?
Hidden
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2242
Erhaltene Danke: 55

Win10
VS Code, Delphi 2010 Prof.
BeitragVerfasst: Do 14.08.08 18:28 
Hi,

Schau mal weiter unten, müsste extra Komponenten für Passwörter geben: MaskEdit oder so heißt das.

PS: So ein Fenster beim Schließen des Programms ist eig. immer nervig, lass das lieber raus ;)

Edit: Was für ein Fehler denn, sei nicht so präzise ;)

mfG,

_________________
Centaur spears can block many spells, but no one tries to block if they see that the spell is a certain shade of green. For this purpose it is useful to know some green stunning hexes. (HPMoR)
Calculon
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 676

Win XP Professional
Delphi 7 PE, Delphi 3 PRO
BeitragVerfasst: Do 14.08.08 18:31 
user profile iconDude566 hat folgendes geschrieben:
[..]
Es funktioniert nicht, es kommt ein Fehler, kann mir einer sagen was falsch ist?

Du musst die Prozedur auch deklarieren. Das sollte automatisch geschehen, wenn du auf die Form doppelklickst.

Gruß
--
Dude566 Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Do 14.08.08 18:41 
Danke, war mein Fehler, wir haben erst 3h Info-Unterricht gehabt.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Do 14.08.08 19:00 
Die Einstellung kannst du übrigens auch direkt im Objektinspektor vornehmen, so dass du dafür gar keinen Code brauchst.

_________________
PROGRAMMER: A device for converting coffee into software.
Dude566 Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Fr 15.08.08 12:58 
user profile iconXentar hat folgendes geschrieben:
Die Einstellung kannst du übrigens auch direkt im Objektinspektor vornehmen, so dass du dafür gar keinen Code brauchst.


Aha, wie und wo?
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Fr 15.08.08 13:04 
Edit auswählen -> Objektinspektor (F11) -> Properties / Eigenschaften -> PasswordChar / Passwortzeichen
Dude566 Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1592
Erhaltene Danke: 79

W8, W7 (Chrome, FF, IE)
Delphi XE2 Pro, Eclipse Juno, VS2012
BeitragVerfasst: Fr 15.08.08 15:59 
So dann wäre alles geklärt, bin aber offen für Vorschläge.