Page 1 of 1

How to organize/keep track of assigned #'s while coding

Posted: Mon Apr 08, 2024 11:47 pm
by dfw1417
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.

Re: How to organize/keep track of assigned #'s while coding

Posted: Tue Apr 09, 2024 12:38 am
by Quin
I just use constants :wink: 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

Posted: Tue Apr 09, 2024 8:34 am
by Caronte3D
Use enumeration:

Code: Select all

Enumeration Windows
  #Window_0
  #Window_1
  #Window_popup
  #Window_XX
  #Window_mine
EndEnumeration

Re: How to organize/keep track of assigned #'s while coding

Posted: Tue Apr 09, 2024 10:30 am
by DarkDragon
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

Re: How to organize/keep track of assigned #'s while coding

Posted: Tue Apr 09, 2024 7:47 pm
by spikey
Caronte3D wrote: Tue Apr 09, 2024 8:34 am Use enumeration:
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

Posted: Wed Apr 10, 2024 5:35 pm
by Caronte3D
spikey wrote: Tue Apr 09, 2024 7:47 pm I'd suggest...
Of course! That was just an example of Enumeration, not good practice. :D