Autor Beitrag
ceding
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 53

Win XP
D 4
BeitragVerfasst: Sa 05.03.05 20:24 
nacht!
wie wird Boolean in Integer umgewandelt??


Moderiert von user profile iconChristian S.: Topic aus VCL (Visual Component Library) verschoben am Sa 05.03.2005 um 19:24

_________________
Es gibt kein Gott!! Was ist die Seele ?
goog
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37



BeitragVerfasst: Sa 05.03.05 20:41 
Hi ceding!

Das weiß nur Bill Gates :wink:
Nein im Ernst, das ist nicht möglich :!:

gruß goog
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: Sa 05.03.05 20:52 
Sicher ist da s möglich :roll:

ausblenden Delphi-Quelltext
1:
MyInt := Ord(MyBool)					


AXMD
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Sa 05.03.05 20:53 
Ne andere Frage ist, was bringt das?

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Sa 05.03.05 20:54 
Doch:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.Button1Click(Sender: TObject);
begin
  // Rückwärts
  showmessage(inttostr(integer(checkbox1.Checked)));
  // Vorwärts
  if Boolean(integer(checkbox1.checked)) then
    showmessage('checked!');
end;

// Oder auch
procedure TForm1.Button2Click(Sender: TObject);
begin
  if Boolean(24then
    showmessage('checked!');
end;


Bei letzterem gilt: Ist der Integer = 0 gilt das als False. Ist er != 0 gilt das als True.

//edit: 1. Zu langsam und 2. auch noch die Frage falsch rum gelesen... Ich glaub ich werd alt... :roll:

_________________
JSXGraph
NeoInDerMATRIX
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 245

Win95, Win98(+se), WinNT, Win2000, WinME, WinXP(+pro), VISTA, Linux(SuSe), DOS [MultiMon(3)], Vista
D6 PeE + (FP 2.0l) + D3 Pe + D2005+ D2006 Arch
BeitragVerfasst: Sa 05.03.05 20:56 
Hi,

also das geht ganz einfach!

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Function BoolToStr(vWert: Boolean): String;
Begin
    If (vWert) Then
        Result := 'TRUE'
    Else
        Result := 'FALSE';
End;

Function IntToBool(vWert: Integer): Boolean;
Begin
    Result := vWert <> 0;
End;


Cu
Neo
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 05.03.05 20:58 
es gibt BoolToStr(), und daraus kann man natürlich auch StrToInt() machen

da steht auch was von der Funktion BoolToInt()
www.koders.com/delph...86A6A40118D2478.aspx

Wozu brauchst du das?
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Sa 05.03.05 21:24 
omg... was gibts da zu konvertieren ?
ist das teil 0 dann isses false isses 1 dann true

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
ceding Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 53

Win XP
D 4
BeitragVerfasst: So 06.03.05 16:45 
tach !
Auf die Frage "was bringt das?" erspart mir ne menge Arbeit GTA-Place
Schade Neo_in_der_MATRIX brauch ich nicht
Wie kann man nor so ein ... schreiben OneOfTen geht nicht

raziel danke!

_________________
Es gibt kein Gott!! Was ist die Seele ?
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 06.03.05 16:59 
was geht nicht?
ceding Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 53

Win XP
D 4
BeitragVerfasst: So 06.03.05 17:03 
na BoolToInt()
oder BoolToStr()

_________________
Es gibt kein Gott!! Was ist die Seele ?
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: So 06.03.05 17:03 
retnyg hat folgendes geschrieben:
omg... was gibts da zu konvertieren ?
ist das teil 0 dann isses false isses 1 dann true

Nicht ganz... ist es 0, dann ist es False, ist es _ungleich_ 0, ist es True..!

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
OneOfTen
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 06.03.05 17:16 
ceding hat folgendes geschrieben:
na BoolToInt()
oder BoolToStr()


haste dir schon mal den dabeistehenden link angeguckt?
ceding Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 53

Win XP
D 4
BeitragVerfasst: Fr 18.03.05 18:09 
öh ja aber was hilft mir das?
ich find das nicht

_________________
Es gibt kein Gott!! Was ist die Seele ?
Sprint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 849



BeitragVerfasst: Fr 18.03.05 18:37 
Boolean - 1 Byte
  • True = 1
  • False = 0

ByteBool - 1 Byte
  • True = -1
  • False = 0

WordBool - 2 Bytes
  • True = -1
  • False = 0

LongBool - 4 Bytes
  • True = -1
  • False = 0


Motzi hat folgendes geschrieben:
Nicht ganz... ist es 0, dann ist es False, ist es _ungleich_ 0, ist es True..!

Damit ist Motzi's Aussage bei allen vier Boolesche Typen von Delphi bestätigt.

_________________
Ciao, Sprint.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Fr 18.03.05 18:42 
user profile iconSprint hat folgendes geschrieben:
Boolean - 1 Byte

dachte immer ein boolean sei ein bit gross :mrgreen:

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Fr 18.03.05 19:08 
(War das soeben eine ernste Bemerkung? Ein Boolean ist ein Byte gross, das stimmt schon)
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Fr 18.03.05 19:13 
habs grade in der delphi-hilfe gesehen - welch platzverschwendung !
da hätt ich ja bislang gleich mit byte arbeiten können... naja, wird wohl für den compiler einfacher zu verwalten sein, sonst braucht der nen dword um sich die speicheradresse des bool's zu merken und nochmal ein byte, um die position des booleans in einem byte zu finden....

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Popov
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 1655
Erhaltene Danke: 13

WinXP Prof.
Bei Kleinigkeiten D3Pro, bei größeren Sachen D6Pro oder D7
BeitragVerfasst: Fr 18.03.05 19:18 
user profile iconretnyg hat folgendes geschrieben:
dachte immer ein boolean sei ein bit gross :mrgreen:


Eigentlich schon, aber es gibt die kleinste Verbrauchseinheit bei Variablen, und die ist ein Byte groß. Bei Flags kriegst du in einen Byte mehrere Boolwerte rein, bei Variablen kommst du nicht unter ein Byte weg.

_________________
Popov
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Fr 18.03.05 19:19 
Es gibt vor allem keine Pointer, die auf ein Bit zeigen können. Wenn du Platz sparen möchtest, kannst du set of byte nehmen, dann bekommst du 256 Bits in 32 Bytes verpackt.