Enumeration etiquette

Just starting out? Need help? Post your questions and find answers here.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Enumeration etiquette

Post by Foz »

Out of curiosity then - what is better in terms of minimum "holes": predefined constants or #PB_Any?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Enumeration etiquette

Post by Fred »

#PB_Any is a linkedlist internally, so you have a small overhead against static number (which are stored in a contigous array), but you can't have any hole.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Enumeration etiquette

Post by Foz »

Superb :mrgreen:

Thanks Fred!
Zach
Addict
Addict
Posts: 1675
Joined: Sun Dec 12, 2010 12:36 am
Location: Somewhere in the midwest
Contact:

Re: Enumeration etiquette

Post by Zach »

Curious if there is a list anywhere, or some rules to go by, that would help me determine how to group objects into separate enumerations?
I still have cases where I'd like to use Enums versus a bunch of typing, or declaring on the fly w/PB_Any

So I'd like to teach myself how to recognize Objects that have their own unique List of numbers, and which objects belong in which group..


Would I essentially need to write a new Enum for each unique object I use?

i.e Menus & Submenus might share the same number list, but a ListView and a TreeView Gadget each have different lists?

A TextGadget (for labeling UI fields) has its own list, but I could Enumerate 20, 30, however many under that same Enumeration..


Is that basically how it works? For each Unique object, it gets its own LinkedList for Enumerations, although they will store "related" objects together (i.e Menu/Submenu, Panel/Tabs ? )
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Enumeration etiquette

Post by Foz »

I believe it's nice and simple - open up Help and look at the General Libraries section in the Reference Manual.

For each Library, each will have it's own counter, so:
Window
Gadget
Menu
Toolbar
etc.

I could be wrong, but that's how I understand it.
Post Reply