Are enumerated constants Global?
Posted: Fri Sep 04, 2015 3:08 am
Learning PB is going well, but I ran into an error today I don't understand. I'll try to explain clearly enough so I don't have to post code:
I have my main source .pb file in which I have enumerated some menu items for my main (and only) window. The order of coding in this file is from top to bottom: 1. Define a couple of Global variables, 2. XInclude all other source code .pb files containing procedures, 3. Enumerate menu item constants, 4. Create and open my Main window, and 5. Event Loop.
I hand off some events to be processed by code in a Procedure contained in one of the XIncluded files. All works well until I try to change the state (Enable/Disable) menu items by referencing their assigned constants, at which time I get a "Constant not found" error during compilation. This operation is contained in an XIncluded Procedure source file. If I change the reference from the #Constant name to the constant numerical value all works as intended. Are constants defined/enumerated in the main source code file not global and available to procedures or do I have a code ordering problem?
Any help greatly appreciated.
Best,
john
I have my main source .pb file in which I have enumerated some menu items for my main (and only) window. The order of coding in this file is from top to bottom: 1. Define a couple of Global variables, 2. XInclude all other source code .pb files containing procedures, 3. Enumerate menu item constants, 4. Create and open my Main window, and 5. Event Loop.
I hand off some events to be processed by code in a Procedure contained in one of the XIncluded files. All works well until I try to change the state (Enable/Disable) menu items by referencing their assigned constants, at which time I get a "Constant not found" error during compilation. This operation is contained in an XIncluded Procedure source file. If I change the reference from the #Constant name to the constant numerical value all works as intended. Are constants defined/enumerated in the main source code file not global and available to procedures or do I have a code ordering problem?
Any help greatly appreciated.
Best,
john