1 of 10 labels not displaying

Just starting out? Need help? Post your questions and find answers here.
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: 1 of 10 labels not displaying

Post 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...
BarryG
Addict
Addict
Posts: 4174
Joined: Thu Apr 18, 2019 8:17 am

Re: 1 of 10 labels not displaying

Post 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
User avatar
hujambo
User
User
Posts: 48
Joined: Wed May 15, 2013 8:26 pm
Location: South Pacific

Re: 1 of 10 labels not displaying

Post by hujambo »

Thanks Josh and Shardik ... I won't be using numbers any more :o
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 283
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: 1 of 10 labels not displaying

Post 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.
Proud supporter of PB! * Musician * C64/6502 Freak
Post Reply