pjay wrote: Sun Sep 15, 2024 8:47 am
But the enumeration name 'Gadgets' should be treated as the start value parameter, should it not?
Otherwise there's no way to benefit from the Named enumeration whilst also using the Step operator.
No it should not.
An enumeration has several qualities:
- A step value (this may be a binary multiplication step option instead of an addition)
- While enumeration is being done the constant #PB_Compiler_EnumerationValue holds the next value to be assigned
A named enumeration records each of these values. The values will be used in future enumeration blocks by simply specifying the enumeration name (and only the name).
If you use the Step operator with a named enumeration it can only be used on the initial enumeration block. Subsequent ones only reference the step and current enumeration value already in progress.
You can obtain the same functionality of changing the Step with just a little more work, like so:
Code: Select all
Enumeration Gadgets
#MyGad_0
#MyGad_1
EndEnumeration
Enumeration Gadgets ; Text / TrackBar / Value
;Step 3
#MyGad_4 = #PB_Compiler_EnumerationValue + 2
#MyGad_7 = #PB_Compiler_EnumerationValue + 2
#MyGad_10 = #PB_Compiler_EnumerationValue + 2
EndEnumeration
Debug #MyGad_0 ;0
Debug #MyGad_1 ;1
Debug #MyGad_4 ;4
Debug #MyGad_7 ;7
Debug #MyGad_10 ;10
I would also point out that for object IDs there is a disadvantage for skipping IDs because memory space is allocated according to the highest object ID used for a given object type even when the lower IDs are not all in use.