How to organize/keep track of assigned #'s while coding
How to organize/keep track of assigned #'s while coding
I currently have a project which has over 1500 lines of code. I have divided it by include files (project tabs) and have one main file which has definitions and total program overview using include files for procedures, mainformobjects, mainformlocations, events, etc. It all does very well however what I have been unable to organize / keep track of are my assigned #numbers. I would like to get an idea of how other coders keep track of these manually assigned #numbers for gadgets, ;windows, etc. I guess the best solution may be an excel file on a 2nd monitor window to keep notes, but certainly there must be a better way. Any thoughts are appreciated.
Experience is what you get when you didn't get what you thought you wanted!
Acer TC895 32gb i5-2.9ghz Win10 1.5tb ssd Asus Gsyn 4k and Vizio 1080 hd monitors.
Acer TC895 32gb i5-2.9ghz Win10 1.5tb ssd Asus Gsyn 4k and Vizio 1080 hd monitors.
Re: How to organize/keep track of assigned #'s while coding
I just use constants
that way all I have to remember is the name of the constant, and honestly because of the amazingness that is PB projects, autocomplete does that for me in most cases.

Re: How to organize/keep track of assigned #'s while coding
Use enumeration:
Code: Select all
Enumeration Windows
#Window_0
#Window_1
#Window_popup
#Window_XX
#Window_mine
EndEnumeration
-
- Addict
- Posts: 2344
- Joined: Mon Jun 02, 2003 9:16 am
- Location: Germany
- Contact:
Re: How to organize/keep track of assigned #'s while coding
Enumerations or #PB_Any for everything.
You can also specify start values for enumerations and you can use #PB_Compiler_EnumerationValue.
https://www.purebasic.com/documentation ... tions.html
You can also specify start values for enumerations and you can use #PB_Compiler_EnumerationValue.
https://www.purebasic.com/documentation ... tions.html
bye,
Daniel
Daniel
Re: How to organize/keep track of assigned #'s while coding
I'd suggest being shorter on the "Window" bit for conciseness ie Win, Wdw or even Wn, and use longer and always descriptive names.
So never #Window_1 but always something like #WinLogin, #WinSchemaWarning, #BtnOk, #BtnCancel, #MnuFile...
I also assign enumeration names to things like panel numbers on panel gadgets (#Pnl...) and status bars (#Sbp...) because this makes the source more readable too and you don't have to remember which panel does what.
Then as Quin says autocomplete really starts to work for you because everything gets categorized.
Re: How to organize/keep track of assigned #'s while coding
Of course! That was just an example of Enumeration, not good practice.
