Just starting out? Need help? Post your questions and find answers here.
danny88
User
Posts: 38 Joined: Sun Jan 21, 2024 8:13 am
Post
by danny88 » Sat Mar 16, 2024 4:33 pm
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 ??
infratec
Always Here
Posts: 7662 Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany
Post
by infratec » Sat Mar 16, 2024 4:41 pm
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
mk-soft
Always Here
Posts: 6320 Joined: Fri May 12, 2006 6:51 pm
Location: Germany
Post
by mk-soft » Sat Mar 16, 2024 4:53 pm
PB object numbers should start with zero for each type. So your example is still correct
danny88
User
Posts: 38 Joined: Sun Jan 21, 2024 8:13 am
Post
by danny88 » Sat Mar 16, 2024 5:02 pm
infratec wrote: Sat Mar 16, 2024 4:41 pm
Where in the documentation?
The example I gave is from the documentation
danny88
User
Posts: 38 Joined: Sun Jan 21, 2024 8:13 am
Post
by danny88 » Sat Mar 16, 2024 5:04 pm
My bad .....
infratec
Always Here
Posts: 7662 Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany
Post
by infratec » Sat Mar 16, 2024 7:37 pm
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