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

Win XP
D6 Pers
BeitragVerfasst: Di 19.10.04 20:21 
hmm kann mir einer sagen warum das net funzt????
ausblenden Quelltext
1:
2:
lrw1.left:=0;
lrw1.Top:=(form1.height/6);

achja und als fehlermeldung kommt dann

inkopatible typen integer und extended

vielen dank im vorraus


Moderiert von user profile iconChristian S.: Topic aus Multimedia / Spiele / Grafik verschoben am Di 19.10.2004 um 22:19
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Di 19.10.04 20:25 
Hi,

ganz einfach: wenn du mit / dividierst, kommt immer eine Kommazahl raus - nimm einfach div, dann wirds wieder ganzzahlig :)

AXMD
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Di 19.10.04 20:26 
Try div
ausblenden Delphi-Quelltext
1:
2:
lrw1.left:=0;
lrw1.Top:=(form1.height div 6);

Bei / ist das Ergebnis eine Gleitkommazahl vom Typ Extended, was natürlich inkompatible zu einem Ganzzahlentyp wie Integer ist. Mit div wird ganzzahlig dividiert, es wird quasi "auf eine ganze zahl abgerundet".

raziel

_________________
JSXGraph
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: Di 19.10.04 20:26 
Die normale Division ergibt ja nicht notwendigerweise eine ganze Zahl, sondern eben eine rationale Zahl, also mit Kommastellen.
So gehts:
lrw1.Top:=(form1.height DIV 6); oder
lrw1.Top:=Round(form1.height/6); oder
ausblenden Delphi-Quelltext
1:
lrw1.Top:=Trunc(form1.height/6);					

Die Unterschiede kann man in der Hilfe nachlesen.

oh mann, ich werd alt...zwei mal zu langsam :lol:

_________________
We are, we were and will not be.
matzerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP
D6 Pers
BeitragVerfasst: Di 19.10.04 22:33 
danke an alle für die schnelle und übereinstimmenden antworten da kann ich ja sicher sein dasses funzt ^^


hmmm kann ich das topi closen...*nachschau*... nee *nach admin ruf*!!!!
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Di 19.10.04 22:40 
matzerg hat folgendes geschrieben:
hmmm kann ich das topi closen...*nachschau*... nee *nach admin ruf*!!!!

Bei uns werden Topics nicht einfach so geschlossen.. ;) Aber du kannst es auf "erledigt" setzen, indem du ganz oben auf das "grüne Häckchen" klickst. Dann sieht jeder, dass dieser Thread abgeschlossen und die Frage beantwortet ist! :)

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!