#PB_Event_FirstCustomValue & #PB_Compiler_EnumerationValue
Posted: Tue Aug 09, 2016 10:24 am
Hi,
Back to trying out PB - I bought license a while back but never really used it much. After succesfully using the excellent SpiderBasic on a couple of projects, I thought I'd try it's older sibling again
Is the following behaviour as expected for the PB constants #PB_Event_FirstCustomValue and #PB_Compiler_EnumerationValue?
Scenario: I need to set up some custom events, and I'm using #PB_Event_FirstCustomValue to define these, but the compiler's enumeration value is then bumped up to that level - is there only a single enumeration stack/counter in the compiler?
Simplified sample code:
Gives the following output in the debugger:
And the program then exits when trying to execute the OpenWindow() command with the following error:
Should custom events always be defined last to avoid this problem? Just seeking guidance on PB best practice when using enumerations including custom events.
Thanks
Back to trying out PB - I bought license a while back but never really used it much. After succesfully using the excellent SpiderBasic on a couple of projects, I thought I'd try it's older sibling again
Is the following behaviour as expected for the PB constants #PB_Event_FirstCustomValue and #PB_Compiler_EnumerationValue?
Scenario: I need to set up some custom events, and I'm using #PB_Event_FirstCustomValue to define these, but the compiler's enumeration value is then bumped up to that level - is there only a single enumeration stack/counter in the compiler?
Simplified sample code:
Code: Select all
Enumeration #PB_Event_FirstCustomValue
#CONST_1
EndEnumeration
Enumeration #PB_Compiler_EnumerationValue
#CONST_2
EndEnumeration
Debug "1: " + Str(#CONST_1) + ", 2: " + Str(#CONST_2)
OpenWindow(#CONST_2, 0,0,100,100, "TEST")
EndCode: Select all
1: 65536, 2: 65537Code: Select all
[10:11:55] [ERROR] #Window object number is very high (over 5000), are You sure of that ?
Thanks