Autor Beitrag
shrubman
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Di 16.11.04 15:24 
Wie erstelle ich mit einem Click ein Label was soviele _ anzeigt wie mein Wort in Label1.Caption lang ist ?? und zwischen einem _ und einem anderen _ soll ein bisschen platz sein...
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 16.11.04 15:34 
ausblenden Delphi-Quelltext
1:
2:
3:
  Label2.Caption := '';
  for a := 1 to Length(Label1.Caption) do
    Label2.Caption := Label2.Caption + '_ ';
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Di 16.11.04 15:34 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function GetUnderscores(sInput: string): string;
var
  i: integer;
begin
  i := 0;
  result := '';
  while (i <  length(sInput)) do
  begin
    result := result + '_ ';
    inc(i);
  end;
end;


Aufrufen mit:

ausblenden Delphi-Quelltext
1:
Label2.Caption := GetUnderscores(Label1.Caption);					


Nicht getestet, sollte aber funzen..



MrSaint

EDIT: Da war ich wohl zu langsam ;)

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
shrubman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Di 16.11.04 15:59 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
for x:=1 to laenge do
begin
ausgabe[x]:=Tlabel(Form1);
ausgabe[x].Parent:=Form1;
ausgabe[x].Caption:='_';
ausgabe[x].Height:=13;
ausgabe[x].Left:=13;
ausgabe[x].Top:=104;
ausgabe[x].width:=3;
ausgabe[x].Visible:=True;
end;

so in der art hab ich das gedacht klappt nur nicht...
shrubman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Di 16.11.04 16:46 
create nach Tlabel macht zwar ein label aber es steht immer nur ein _ da und laenge ist 100% als länge für das wort ...
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Di 16.11.04 17:20 
so wie ich das sehe willst du für jeden Buchstaben ein eigenes Label erstellen (was schonmal nicht deiner Frage entspricht), aber vielleicht solltest du die Ausrichtung der Labels auch anpassen (also den Left Wert), bei dir haben nämlich alle den gleichen liegen also übereinander

auch wenn ich nicht verstehe warum du nicht alles in ein Label schreiben willst

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
shrubman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Di 16.11.04 17:43 
wie geht das denn ?
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Di 16.11.04 17:55 
was? Label ausrichten (über Left) oder alles in ein Label (das ist das was dir die anderen hier alle gepostet haben)?

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Di 16.11.04 18:37 
Wie immer scheitert alles an der Fragestellung. :x
Bist du vielleicht in der Lage, deine Frage so zu formulieren, dass sie unmissverständlich ist? Bekommen wir das hin?
shrubman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Di 16.11.04 18:42 
hat sich schon geklärt....
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Mi 17.11.04 10:40 
shrubman hat folgendes geschrieben:
hat sich schon geklärt....

Und wie lautet die Lösung?
shrubman Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 47



BeitragVerfasst: Mi 17.11.04 15:27 
ich habe es mit einzelenen labeln gemacht
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
for x:=1 to laenge do
begin
n:=n+10;
ausgabe[x]:=Tlabel.Create(Form1);
ausgabe[x].Parent:=Form1;
ausgabe[x].Caption:='_';
ausgabe[x].Height:=13;
ausgabe[x].Left:=15+n;
ausgabe[x].Top:=104;
ausgabe[x].Visible:=True;
end;
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mi 17.11.04 16:51 
du gibts sie dann auch am Ende wieder frei, oder?

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
Elite
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Mi 17.11.04 17:05 
Ich denke, wenn bei einem Objekt ein Parent gesetzt wird, wird dieses zusammen mit dem übergeordneten Objekt, der Form, frei gegeben oder etwa nicht?
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mi 17.11.04 17:08 
wird das zufällig Galgenraten ???
GSE
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 740

Win 2k, Win XP Pro
D5 Prof, D6 Ent, D2k5 PE
BeitragVerfasst: Mi 17.11.04 17:10 
im Prinzip schon
da mir das aber wie Galgenraten (?) aussieht sollte er sie zwischendurch auch wieder freigeben

und generell handhabe ich es immer so, dass ich alles, was ich erzeugt habe, selbst wieder freigebe

mfg
GSE

_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Mi 24.11.04 14:46 
hab auch grad mal angefangen, galgenraten zu proggen, nur wie prüft
man, dass ein bestimmer buchstabe enthalten ist, und ändert diesen
entsprechend auf dem Label ???
Loki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34

Win XP Home

BeitragVerfasst: Mi 24.11.04 15:12 
Also als wir das mal in der Schule gemacht haben, :D
da hab ich das so gemacht, dass ich zwei Variablen vom Typ String hatte und in einer dann das Lösungswort und einmal das Wort mit den Strichen. Dann hab ich den Buchstaben im Lösungswort gesucht und dann im Ratewort (mit den Strichen) die positionen ersetzt.

Hoffe das hilft wenn es das war was du wissen wolltest :D

MFG

Loki