Autor Beitrag
Airtrox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109


Delphi 7
BeitragVerfasst: Do 17.12.09 21:25 
Abend,

ich will den Interval Wert eines Timers in einem String speichern, um ihn zu speichern. Also muss ich den Wert durch 1000 teilen, da ich nur die Sekundenanzahl haben will:
ausblenden Delphi-Quelltext
1:
2:
timer_var :=  (round(timer1.interval)) / 1000// Hier der Fehler
mein_string := inttostr(timer_var)

Nun bekomme ich den Fehler, dass es inkompatible Typen sind, Integer & Extended, jedoch egal wie ich timer.interval umwandle, kommt immer diese Fehlermeldung. Kann mir vllt. jemand helfen?
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: Do 17.12.09 21:45 
du musst den Wert entweder mit round() runden oder anstelle von / div benutzen
Airtrox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 109


Delphi 7
BeitragVerfasst: Do 17.12.09 22:39 
Ich hab es jetzt mal so gelöst:
durch 1000 geteilt und an eine real Variable gegeben
die Realvariable durch roun() zur Integervariable gemacht.

Vielleicht gibt es auch eine einfachere, direktere Möglichkeit?
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Do 17.12.09 22:44 
Wie FinnO schon sagte, halt statt div benutzen.
Teekeks
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 211
Erhaltene Danke: 23



BeitragVerfasst: Fr 18.12.09 08:30 
ausblenden Delphi-Quelltext
1:
2:
timer_var :=  (round(timer1.interval{Die Klammer muss hinter die 1000-->}){<--} / 1000;
mein_string := inttostr(timer_var)
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Fr 18.12.09 16:32 
user profile iconBoldar hat folgendes geschrieben Zum zitierten Posting springen:
Wie FinnO schon sagte, halt statt div benutzen.