Autor Beitrag
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 28.05.05 16:02 
ausblenden Delphi-Quelltext
1:
Fett := readbool('bt'+inttostr(hbt),'Bold',Fett); //Nimmt nicht true an					

Obwohl da 'true' drinsteht behält die Variable den vorherzugewiesenen Wert 'false'.
Sieht jemand nen Fehler?
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Sa 28.05.05 16:07 
user profile iconFabian W. hat folgendes geschrieben:
ausblenden Delphi-Quelltext
1:
Fett := readbool('bt'+inttostr(hbt),'Bold',Fett); //Nimmt nicht true an					


müsste dann heißen:
ausblenden Delphi-Quelltext
1:
Fett := readbool('bt'+inttostr(hbt),'Bold',true (!!!!!) );					

oder du setzt Fett vorher auf true

_________________
Programmers never die, they just GOSUB without RETURN
teebee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 109


D6 Prof
BeitragVerfasst: Sa 28.05.05 16:12 
ReadBool unterscheidet nicht die Strings 'True' oder 'False' sondern '0' und nicht '0'.

Gruß, teebee
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Sa 28.05.05 16:30 
user profile iconteebee hat folgendes geschrieben:
ReadBool unterscheidet nicht die Strings 'True' oder 'False' sondern '0' und nicht '0'.

Gruß, teebee

Neeeee,
ReadBool funktioniert mit bool'schen Werten, also true oder false (intern natürlich mit Strings, aber das ist doch hier nicht wichtig). Da kannst du mir erzählen was du willst.

Das oben war bloß ein schreibfehler.

_________________
Programmers never die, they just GOSUB without RETURN
teebee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 109


D6 Prof
BeitragVerfasst: Sa 28.05.05 16:42 
Auszug aus der inifiles.pas:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
function TIniFile.ReadBool(const Section, Ident: string;
  Default: Boolean): Boolean;
begin
  Result := ReadInteger(Section, Ident, Ord(Default)) <> 0;
end;

procedure TIniFile.WriteBool(const Section, Ident: string; Value: Boolean);
const
  Values: array[Boolean] of string = ('0''1');
begin
  WriteString(Section, Ident, Values[Value]);
end;


Gruß, teebee
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Sa 28.05.05 16:50 
user profile iconteebee hat folgendes geschrieben:
Auszug aus der inifiles.pas:
[delphi]function TIniFile.ReadBool(const Section, Ident: string;
Default: Boolean): Boolean;

Bitte schön, der Parameter Default ist boolean;

@Fabian: geht's?

_________________
Programmers never die, they just GOSUB without RETURN
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 28.05.05 16:52 
Zitat:
ausblenden Delphi-Quelltext
1:
Fett := readbool('bt'+inttostr(hbt),'Bold',true (!!!!!) );					

Es kann sein dass in der Ini true oder false steht, das ist euch klar? das vorher zugewiesene false ist nur zum initialiesieren.

Eurer Meinung nach müsste es so gehen:

ausblenden Delphi-Quelltext
1:
2:
 Fett := false;
Fett := readbool('bt'+inttostr(hbt),'Bold',true);


gut ich versuch's mal.
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 28.05.05 16:54 
Der von mir jetzt genannte Code setzt fett zwar auf true, aber wenn false in der Ini steht auch auf true.
Steh ich völlig auf der Leitung, oder is das n rießen Sch****?
teebee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 109


D6 Prof
BeitragVerfasst: Sa 28.05.05 16:55 
user profile iconalias5000 hat folgendes geschrieben:
Bitte schön, der Parameter Default ist boolean;

Eben. Und 'Fett' ist ja auch als Boolean deklariert. Bei entsprechender Vorbelegung also kein Problem die Variable zu benutzen.

Gruß, teebee
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 28.05.05 16:57 
Könnten wir uns zuerst um mein Problem kümmern? Dann streite ich gern mit :wink:
teebee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 109


D6 Prof
BeitragVerfasst: Sa 28.05.05 16:59 
In der Ini darf nicht 'True' oder 'False' stehen, sondern '0' (für False) und '1' für True.

Aber wer streitet denn hier?
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Sa 28.05.05 17:03 
Ok, also letzter Tipp, bist du dir sicher, dass die angeforderte Section existiert?

_________________
Programmers never die, they just GOSUB without RETURN
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Sa 28.05.05 17:04 
Hallo,

Das letzte Argument für ReadBool ist ein Default-Wert, der eingesetzt wird, wenn ReadBool fehlschlägt.
Setz doch da mal False ein.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
Fabian W. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Sa 28.05.05 17:06 
Ja natürrlich besteht die section. Ich hba den fehler jetzt gefunden, danke.
Vor der Null 1 warn Leerzeichen.