Just starting out? Need help? Post your questions and find answers here.
Wolfram
Enthusiast
Posts: 604 Joined: Thu May 30, 2013 4:39 pm
Post
by Wolfram » Thu Dec 21, 2017 7:45 pm
I use Enumeration #PB_Event_FirstCustomValue in different files which I include in one main file.
Is it normal that they have the same value?
I would expect it starts with the next higher value.
FileA.pb
Code: Select all
Enumeration #PB_Event_FirstCustomValue
#A
#B
EndEnumeration
FileB.pb
Code: Select all
Enumeration #PB_Event_FirstCustomValue
#C
#D
EndEnumeration
MainFile.pb
Code: Select all
XIncludeFile "FileA.pb"
XIncludeFile "FileB.pb"
Debug #A
Debug #B
Debug #C ;same as #A
Debug #D ;same as #B
macOS Catalina 10.15.7
Josh
Addict
Posts: 1183 Joined: Sat Feb 13, 2010 3:45 pm
Post
by Josh » Thu Dec 21, 2017 8:02 pm
Like the name says, it is the first custom value
Try following:
Code: Select all
Enumeration MyEnumName #PB_Event_FirstCustomValue
#A
#B
EndEnumeration
Code: Select all
Enumeration MyEnumName
#C
#D
EndEnumeration
Maybe its a better way to write a dummy-enumeration in the mainfile and use clean named enums in the includefiles. With this, you will never have a problem if the order of the include-files is changing.:
Code: Select all
Enumeration MyEnumName #PB_Event_FirstCustomValue
EndEnumeration
Code: Select all
Enumeration MyEnumName
#A
#B
EndEnumeration
Code: Select all
Enumeration MyEnumName
#C
#D
EndEnumeration
sorry for my bad english
ts-soft
Always Here
Posts: 5756 Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany
Post
by ts-soft » Thu Dec 21, 2017 8:53 pm
Here an example with modules!
Code: Select all
CompilerIf Defined(CommonConstants, #PB_Module) = 0
DeclareModule CommonConstants
; Form
Enumeration FormWindow
EndEnumeration
Enumeration FormGadget
EndEnumeration
Enumeration FormMenu
EndEnumeration
Enumeration FormImage
EndEnumeration
Enumeration FormFont
EndEnumeration
; Event
Enumeration EventCustom #PB_Event_FirstCustomValue
EndEnumeration
Enumeration EventTypeCustom #PB_EventType_FirstCustomValue
EndEnumeration
EndDeclareModule
Module CommonConstants
EndModule
CompilerEndIf
This is the first defined includefile.
Use for all modules, that require some of constants:
PureBasic 5.73 |
SpiderBasic 2.30 |
Windows 10 Pro (x64) |
Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.