Autor Beitrag
hui1991
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Di 11.04.06 11:10 
Immer wenn ich die Zahl in SpinEdit markiere und eine Zahl eintippe kommt eine Fehlermeldung. Wie kann ich überprüfen ob es jetzt ein Integer ist?

MfG
hui1991
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 11.04.06 11:23 
Versuch mal TryStrToInt ... Oder per Val den Fehlercode abfragen ... Ansonsten geht auch StrToIntDef(S, 0) = StrToIntDef(S, 1)

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
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 11.04.06 16:40 
in ein SpinEdit kann man doch sowieso nur Zhlen eintippen !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
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 11.04.06 16:51 
user profile iconmatze hat folgendes geschrieben:
in ein SpinEdit kann man doch sowieso nur Zhlen eintippen !


So ist es. Ich glaube daher, dass sich
user profile iconhui1991 hat folgendes geschrieben:
Immer wenn ich die Zahl in SpinEdit markiere und eine Zahl eintippe kommt eine Fehlermeldung.
darauf bezieht, dass beim Überschreiben kurzzeitig der Zustand "Leerstring" im SpinEdit vorliegt - daher meldet Delphi einen Fehler. Außerhalb der IDE tritt der soweit ich weiß aber nicht auf.

AXMD
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 11.04.06 17:27 
das wäre mir auch neu.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Di 11.04.06 17:40 
Da es sich ja noch auf SpinEdit bezieht frage ich mal wie man diesen Code verkürzen kann:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
  Form1.startwert[1]:=SpinEdit1.Value*1000;
  Form1.startwert[2]:=SpinEdit3.Value*1000;
  Form1.startwert[3]:=SpinEdit5.Value*1000;
  Form1.startwert[4]:=SpinEdit7.Value*1000;
  Form1.startwert[5]:=SpinEdit9.Value*1000;
  Form1.startwert[6]:=SpinEdit11.Value*1000;
  Form1.startwert[7]:=SpinEdit13.Value*1000;
  Form1.startwert[8]:=SpinEdit15.Value*1000;
  Form1.startwert[9]:=SpinEdit17.Value*1000;
  Form1.startwert[10]:=SpinEdit19.Value*1000;
  Form1.startwert[11]:=SpinEdit21.Value*1000;
  Form1.startwert[12]:=SpinEdit23.Value*1000;
  Form1.wieholungswert[1]:=SpinEdit2.Value*1000;
  Form1.wieholungswert[2]:=SpinEdit4.Value*1000;
  Form1.wieholungswert[3]:=SpinEdit6.Value*1000;
  Form1.wieholungswert[4]:=SpinEdit8.Value*1000;
  Form1.wieholungswert[5]:=SpinEdit10.Value*1000;
  Form1.wieholungswert[6]:=SpinEdit12.Value*1000;
  Form1.wieholungswert[7]:=SpinEdit14.Value*1000;
  Form1.wieholungswert[8]:=SpinEdit16.Value*1000;
  Form1.wieholungswert[9]:=SpinEdit18.Value*1000;
  Form1.wieholungswert[10]:=SpinEdit20.Value*1000;
  Form1.wieholungswert[11]:=SpinEdit22.Value*1000;
  Form1.wieholungswert[12]:=SpinEdit24.Value*1000;
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Di 11.04.06 17:49 
Mit einer Schleife + FindComponent

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var n: integer;
...
for n := 0 to 12 do
  Form1.startwert[n]:=Findcomponent('SpinEdit'+inttostr(n*2-1)).Value*1000;
for n := 0 to 12 do
  Form1.wieholungswert[n]:=Findcomponent('SpinEdit'+inttostr(n*2)).Value*1000;

_________________
I believe that every human has a finite number of heart-beats. I don't intend to waste any of mine running around doing exercises.
- Neil Armstrong
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Di 11.04.06 17:59 
Delphi gibt darauf diesen Fehler aus:
ausblenden Quelltext
1:
2:
[Fehler] Unit2.pas(284): Undefinierter Bezeichner: 'Value'
[Fehler] Unit2.pas(289): Undefinierter Bezeichner: 'Value'


Ich hab n als Integer festgelegt.
Mein Delphi gibt fehler bei Ceil und dem Gegenteil aus.
In der Hilfe steht es drin blos bei Delphi funktioniert es nicht.
Ich besitze Delphi 5.
fidionael
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 232

Win XP SP2, Ubuntu 6.06
Delphi 7 PE, Delphi 3 Prof
BeitragVerfasst: Di 11.04.06 18:10 
Versuch es mal hiermit:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
var n: integer;  
...  
for n := 0 to 12 do  
  Form1.startwert[n]:=TSpinEdit(Findcomponent('SpinEdit'+inttostr(n*2-1))).Value*1000;  
for n := 0 to 12 do  
  Form1.wieholungswert[n]:=TSpinEdit(Findcomponent('SpinEdit'+inttostr(n*2))).Value*1000;


Müsste funktionieren, ist allerdings ungetestet.

Mfg
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Di 11.04.06 18:34 
Wie kann ich überprüfen ob das SpinEdit jetzt leer ist denn so kommt immer ein fehler. Weil '' kein Integer wert ist und mit einem String kann ich es nicht vergleichen.
fidionael
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 232

Win XP SP2, Ubuntu 6.06
Delphi 7 PE, Delphi 3 Prof
BeitragVerfasst: Di 11.04.06 18:46 
Was ist denn mit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
if not IntToStr(SpinEdit.Value)='' then
begin
  //Dein Quelltext
end;


Aber ich habe SpinEdits auch schon öfter benutzt und eine solche Abfrage war bei mir nie nötig?!
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Di 11.04.06 18:48 
Bei dem gibt er dies aus:
[Fehler] Unit2.pas(312): Inkompatible Typen: 'String' und 'Integer'

Ich muss dieses Programm öfters testen und muss die Wert zu anfang eintippen.
Deswegen brauche ich das auch.
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 11.04.06 18:53 
ausblenden Delphi-Quelltext
1:
2:
  if SpinEdit1.Text = '' then
    ShowMessage('Nix drin');
hui1991 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 433

Windows XP, WIndows Vista
Turbo Delphi Explorer| Delphi, PHP,Blitzbasic
BeitragVerfasst: Di 11.04.06 19:06 
So das Problem ist jetzt endlich weg.

Danke für eure Unterstützung.
MfG
hui1991