Page 1 of 1
Eumeration bug ???
Posted: Sat Mar 16, 2024 4:33 pm
by danny88
hi
in the documentation we find this :
Code: Select all
Enumeration Window
#FirstWindow ; equals 0
#SecondWindow ; equals 1
EndEnumeration
Enumeration Gadget
#GadgetCancel ; equals 3
#GadgetImage ; equals 4
#GadgetSound ; equals 5
EndEnumeration
however when I write "Debug #GadgetCancel" I get 0
Purebasic 6.02
Is that a bug ??
Re: Eumeration bug ???
Posted: Sat Mar 16, 2024 4:41 pm
by infratec
Where in the documentation?
The enumeration only has a startvalue when both enumerations have the same name.
Else it starts from 0 if you don't set a start value.
Code: Select all
Enumeration Test
#FirstWindow ; equals 0
#SecondWindow ; equals 1
EndEnumeration
Enumeration Test
#GadgetCancel ; equals 2
#GadgetImage ; equals 3
#GadgetSound ; equals 4
EndEnumeration
Enumeration
#T1 ; equals 0
#T2 ; equals 1
EndEnumeration
Enumeration Hello
#A1 ; equals 0
#A2 ; equals 1
EndEnumeration
Re: Eumeration bug ???
Posted: Sat Mar 16, 2024 4:53 pm
by mk-soft
PB object numbers should start with zero for each type. So your example is still correct

Re: Eumeration bug ???
Posted: Sat Mar 16, 2024 5:02 pm
by danny88
infratec wrote: Sat Mar 16, 2024 4:41 pm
Where in the documentation?
The example I gave is from the documentation
Re: Eumeration bug ???
Posted: Sat Mar 16, 2024 5:04 pm
by danny88
My bad .....
Re: Eumeration bug ???
Posted: Sat Mar 16, 2024 7:37 pm
by infratec
Found it: you mean the help for enumeration.
But ...
you forgot the first part:
Example: Named enumeration
Code: Select all
Enumeration Gadget
#GadgetInfo ; will be 0
#GadgetText ; will be 1
#GadgetOK ; will be 2
EndEnumeration
Enumeration Window
#FirstWindow ; will be 0
#SecondWindow ; will be 1
EndEnumeration
Enumeration Gadget
#GadgetCancel ; will be 3
#GadgetImage ; will be 4
#GadgetSound ; will be 5
EndEnumeration