Autor Beitrag
Cyborgeagle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

Win XP Pro
D6 Personal
BeitragVerfasst: Di 27.01.04 15:32 
Ich glaub ich langweile euch nur mit den Programmen meiner Lehrerin, aber trotzdem komm ich nicht weiter.
Wie schaff ich es das er sich D von der Scrollbar holt?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button1Click(Sender: TObject);
var D:integer;
B,R:real;
begin
B:=strtofloat(Edit1.Text);
D:=strtoint(scrollbar1.position);
Case D of
0 .. 5    : R:=0;
6,7,8    : R:=0.1 * B;
9,10,11  : R:=0.13 * B;
12,13,14  : R: =0.18*B;
 else      R:=0.25*B;
End;
Label2.Caption:=floattostr(R);
end;

end.

_________________
"Es gibt zwei Dinge, die sind unendlich: Das Universum und die menschliche Dummheit.
Beim Universum bin ich mir noch nicht sicher." Albert Einstein
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 27.01.04 16:17 
hä ?? also du willst den wert von der scrollbar ??

das steht doch schon im quelltext drin: scrollbar1.position

oder was willst du ?

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Di 27.01.04 16:20 
Allerdings denke ich nicht, dass das "StrToInt" dort etwas zu suchen hat. Denn die Position des Scrollbalkens ist definitv kein String!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
teebee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 109


D6 Prof
BeitragVerfasst: Di 27.01.04 16:22 
Cyborgeagle hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.Button1Click(Sender: TObject);
var D:integer;
B,R:real;
begin
B:=strtofloat(Edit1.Text);
D:= scrollbar1.position; // lass hier mal das StrToInt() weg!
Case D of
0 .. 5    : R:=0;
6,7,8    : R:=0.1 * B;
9,10,11  : R:=0.13 * B;
12,13,14  : R: =0.18*B;
 else      R:=0.25*B;
End;
Label2.Caption:=floattostr(R);
end;

end.

Ohne StrToInt sollte es gehen,

Gruß, teebee
Cyborgeagle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20

Win XP Pro
D6 Personal
BeitragVerfasst: Do 29.01.04 15:19 
Danke.

_________________
"Es gibt zwei Dinge, die sind unendlich: Das Universum und die menschliche Dummheit.
Beim Universum bin ich mir noch nicht sicher." Albert Einstein