I know I have asked how people lay out their programs in the past, but I ran into a problem that is bugging me and I wanted to see how others would handle it.
I guess this is a "What would Jesus do?" question of sorts
I like to try and keep my code fairly organized, like a lot of people of course, which means I have a lot of variables kept inside the procedures that use them. So far this is mainly to do with my GUI code, as I am creating Gadgets by using #ProGUI_Any and storing the returned IDs in a variable named for the Gadget. A lot of it is Text Labels and String Gadgets for user input, and I will definitely have several hundred by the time the GUI itself is finished. There will be some other things like buttons and such too (just added two last night).
The issue I am concerned with is being able to access those variables either from my Event Loop for response to input, or from within other procedures themselves which may act on and change the state of the Gadget.
Right now I have the variables defined within the procedures, like I mentioned.. Using Protected just to be "neat" about it, however when I need to access one or several I end up changing them to Global, although I am trying to keep in mind that "good practice" says avoid Globals unless you really need them. I apparently can't use "Shared" unless I define the variable outside the procedures, in the main source file - which wouldn't necessarily be a problem for me, but I don't think I would be able to see them from other source files.... ? Since my code is compartmentalized to the best of my ability, I'm wondering if I just have to use a lot of globals or if there are other ways to reference variables inside procedures; I thought about pointers but that is messy and I think I would make things worse if I tried to do that..
Has the phobia of "Globals" being used a lot / looking "bad" to others who might read my code been wrongly instilled in me?



