Page 2 of 2

Re: 1 of 10 labels not displaying

Posted: Fri Jul 19, 2019 8:26 am
by Shardik
hujambo wrote:My understating, right or wrong, is that the following:

Code: Select all

Enumeration Images 500
  ; Images
  #img0
  #img1
  #img2
  #img3
  #headerImg
  #searchIcon
EndEnumeration
Just starts the enumeration count at 500.. not that it reserves 500 images?
It's described in detail in PureBasic's help: :wink:
Tab Contents > Various Topics > PureBasic objects overview
PureBasic help for PureBasic objects wrote:I. Indexed numbering

The static, indexed way, allows you to reference an object by a predefined numeric value. The first available index number is 0 and subsequent indexes are allocated sequentially. This means that if you use the number 0 and then the number 1000, 1001 indexes will be allocated and 999 (from 1 to 999) will be unused, which is not an efficient way to use indexed objects...

Re: 1 of 10 labels not displaying

Posted: Fri Jul 19, 2019 8:54 am
by BarryG
IdeasVacuum wrote:You should not have empty lines or comments inside an Enumeration - that can upset the compiler!
Not so. I have both of those and my apps compile and run normally with "broken" enumeration like that. A quick test proves it:

Code: Select all

Enumeration 1

  #one
  
  #two
  
  
  
  ; comment
  
  #three
  #four
  ; blah
  
  #five

EndEnumeration

Debug #one
Debug #two
Debug #three
Debug #four
Debug #five

Re: 1 of 10 labels not displaying

Posted: Fri Jul 19, 2019 8:05 pm
by hujambo
Thanks Josh and Shardik ... I won't be using numbers any more :o

Re: 1 of 10 labels not displaying

Posted: Sat Jul 20, 2019 12:17 am
by oreopa
tl;dr

There is absolutely no problem in using the same enumerated numbers... as long as you are using them for different objects... Windows has its set, gadgets have their own etc...

Furthermore, unless there is some special numerical/calculation reason for it (#btn_SIZE = 24...), there is no real point enumerating from anything other than 0 (1 for binary of course).

There maybe some great benefit in naming enumerations, but I don't find it useful. I just group all my enumerations in sections. And section begins "Enumeration 0".
HeX0R wrote:
IdeasVacuum wrote:Hi
You should not have empty lines or comments inside an Enumeration - that can upset the compiler
:shock:
This can't be true, any example where this happens?
I'm pretty damn sure it's not true :) I've <cr> spaced my enums since 3.xx, and had comments everywhere in them.