|
Post by gungedin on Jan 21, 2019 19:42:11 GMT 1
what do I wrong? I use often arrays in a type like ... -String(14) nr(1 ... 10) ... this work.
- Boolean b(1 ... 32) ... this will not work.
no matter what I try, the value is allways FALSE!!!
nut(zzz).b(5) = True ... It is still FALSE.
Any idea? regards gunnar
---------------------------
Global zzz = 1 Type nutzer_code - String(2) kurz - String(30) name - String(3) sprache - String(2) kasse - String(30) pass - Boolean b(1 ... 32) /* This will not work, why? - Boolean c EndType Global nut(30) As nutzer_code nut(zzz).name = "ICH" Print nut(zzz).name nut(zzz).b(5) = 1 Print nut(zzz).b(5) nut(zzz).b(5) = -1 Print nut(zzz).b(5) nut(zzz).b(5) = 0 Print nut(zzz).b(5) nut(zzz).b(5) = False Print nut(zzz).b(5) nut(zzz).b(5) = True Print nut(zzz).b(5) nut(zzz).c = True Print nut(zzz).c Do Sleep Until Me Is Nothing
|
|
|
Post by scalion on Jan 22, 2019 8:28:12 GMT 1
Hi Gungedin, It seems that the boolean type is really problematic in UDTs. This has already been seen with the problem of the 8th boolean. You have just raised another hare. Pending a new version of GFA-Basic, I propose you this workaround which consists in using another type of variable while preserving the gain of place of type boolean:
Global zzz = 2 Type nutzer_code - String(2) kurz - String(30) name - String(3) sprache - String(2) kasse - String(30) pass '- Boolean b(1 ... 32) /* This will not work, why? - Long b - Boolean c EndType
Global nut(30) As nutzer_code
nut(zzz).name = "ICH" Print nut(zzz).name
'nut(zzz).b(5) = 1 'Print nut(zzz).b(5) NutSetB zzz, 5, 1 Print NutGetB(zzz, 5)
'nut(zzz).b(5) = -1 'Print nut(zzz).b(5) NutSetB zzz, 5, -1 Print NutGetB(zzz, 5)
'nut(zzz).b(5) = 0 'Print nut(zzz).b(5) NutSetB zzz, 5, 0 Print NutGetB(zzz, 5)
'nut(zzz).b(5) = False 'Print nut(zzz).b(5) NutSetB zzz, 5, False Print NutGetB(zzz, 5)
'nut(zzz).b(5) = True 'Print nut(zzz).b(5) NutSetB zzz, 5, True Print NutGetB(zzz, 5)
nut(zzz).c = True Print nut(zzz).c
Do Sleep Until Me Is Nothing Function NutGetB(zzz%, index%) As Boolean Return Btst(nut(zzz).b, Pred(index)) EndFunc Proc NutSetB(zzz%, index%, Value As Boolean) If Value = False Bclr nut(zzz).b , Pred(index) Else Bset nut(zzz).b , Pred(index) EndIf EndProc Have a nice day.
|
|