Eumeration bug ???

Just starting out? Need help? Post your questions and find answers here.
danny88
User
User
Posts: 38
Joined: Sun Jan 21, 2024 8:13 am

Eumeration bug ???

Post 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 ??
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Eumeration bug ???

Post 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
User avatar
mk-soft
Always Here
Always Here
Posts: 6320
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Eumeration bug ???

Post by mk-soft »

PB object numbers should start with zero for each type. So your example is still correct ;)
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
danny88
User
User
Posts: 38
Joined: Sun Jan 21, 2024 8:13 am

Re: Eumeration bug ???

Post by danny88 »

infratec wrote: Sat Mar 16, 2024 4:41 pm Where in the documentation?
The example I gave is from the documentation
danny88
User
User
Posts: 38
Joined: Sun Jan 21, 2024 8:13 am

Re: Eumeration bug ???

Post by danny88 »

My bad .....
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Eumeration bug ???

Post 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
Post Reply