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

Everything else that doesn't fall into one of the other PB categories.
dfw1417
User
User
Posts: 16
Joined: Tue Mar 01, 2022 1:45 am

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

Post 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.
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.
Quin
Addict
Addict
Posts: 1125
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

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

Post 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.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post by Caronte3D »

Use enumeration:

Code: Select all

Enumeration Windows
  #Window_0
  #Window_1
  #Window_popup
  #Window_XX
  #Window_mine
EndEnumeration
DarkDragon
Addict
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

Post 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
bye,
Daniel
User avatar
spikey
Enthusiast
Enthusiast
Posts: 750
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

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

Post 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.
User avatar
Caronte3D
Addict
Addict
Posts: 1355
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

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

Post 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
Post Reply