Autor Beitrag
sTk
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mi 07.09.05 09:02 
Hallo!

Also ich habe gerade mit Delphi angefangen und deshalb noch ein paar Startschwierigkeiten :lol:

Ich will ein Programm erstellen, bei dem, wenn ich auf einen Button klicke Befehle ausgeführt werden.
Wenn ich zum erstenmal klicke - Befehl 1, beim zweiten Klicken Befehl 2 usw.

Kann mir vielleicht jemand einen Lösungsansatz geben, denn irgendwie hab ich gerade ne Blockade!

Gruß, Steffen
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Mi 07.09.05 09:11 
also wie du den knopf hinkriegst weisste ja bestimmt.
dann machste halt ne variable countClicks oder sowas, das muss natürlich ein integer sein.
die zählt dann die klicks.

dann wenn du den button klickst sollte das ganze ca so aussehen:

countClicks:=countClicks+1
wenn countClicks = 1 dann
sonst wenn countClicks = 2 dann
usw
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 07.09.05 09:24 
Vom Ansatz würde ich das auch so machen, allerdings würde ich dann ein "Case" verwenden.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 07.09.05 09:39 
Und ich würde zusätzlich die globale Variable "Count oder so" weglassen, und stattdessen die Eigenschaft Tag des Buttons benutzen :D

_________________
We are, we were and will not be.
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Mi 07.09.05 09:54 
ja mit tag gehts auch.
oder villeicht sogar caption? oder size? :D
naja kann man alles nehmen.
wofür ist tag eigentlich gut? ^^

achja und case ist natürlich besser, ist mir später auch eingefallen
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 07.09.05 10:04 
Tag ist dazu gut, einen Integer-Wert zu speichern.
Delphi-Hilfe hat folgendes geschrieben:
Tag hat keine vordefinierte Bedeutung. Die Eigenschaft Tag steht zur freien Benutzung durch Entwickler zur Verfügung. Sie können in dieser Eigenschaft zusätzliche Informationen über die Komponente in Form einer Ganzzahl speichern oder die Eigenschaft in einen 32-Bit-Wert, wie z.B. in eine Komponentenreferenz oder einen Zeiger, umgewandelt werden.

_________________
We are, we were and will not be.
en!gma
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 378

win xp
delphi 7.0
BeitragVerfasst: Mi 07.09.05 10:05 
naja ok dann ist tag ja wie geschaffen dafür :P
sTk Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win 2000, Win XP
Turbo Delphi Pro, D2005 PE, Lazarus
BeitragVerfasst: Mi 07.09.05 10:54 
Super Danke, wieder was dazugelernt!

Gruß, Steffen
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 07.09.05 11:06 
Hallo!

Eine weitere Lösungs, so etwas zu realisieren, habe ich einmal hier gepostet.

Grüße
Christian

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".