#PB_EventType_FirstCustomValue quetion

Just starting out? Need help? Post your questions and find answers here.
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

#PB_EventType_FirstCustomValue quetion

Post by jassing »

How can I work around this? (without knowing the what the other did)
I had done something like: Enumeration #PB_EventType_FirstCustomValue+1000, but this leaves open manual collisions by chance.

Code: Select all

DeclareModule abc
  Declare xyz()
EndDeclareModule
Module abc
  Enumeration #PB_EventType_FirstCustomValue
    #something
  EndEnumeration
  Procedure xyz()
    ProcedureReturn #something
  EndProcedure
EndModule

Enumeration #PB_EventType_FirstCustomValue
  #somethingelse
EndEnumeration

Debug #somethingelse
Debug abc::xyz()
User avatar
jacdelad
Addict
Addict
Posts: 1991
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: #PB_EventType_FirstCustomValue quetion

Post by jacdelad »

Common module. I stumbled across this too.
https://www.purebasic.fr/english/viewto ... 16#p617116

I still find this confusing...
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: #PB_EventType_FirstCustomValue quetion

Post by jassing »

Less than ideal. Requires a modicum of cooperation not always easy, or reliable.
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: #PB_EventType_FirstCustomValue quetion

Post by Bisonte »

Code: Select all

DeclareModule common
  
  Enumeration EnumEventType #PB_EventType_FirstCustomValue
  EndEnumeration
  
EndDeclareModule
Module common
EndModule


DeclareModule abc
  
  UseModule common
  
  Declare xyz()
EndDeclareModule
Module abc
  Enumeration EnumEventType
    #something
  EndEnumeration
  Procedure xyz()
    ProcedureReturn #something
  EndProcedure
EndModule

UseModule common

Enumeration EnumEventType
  #somethingelse
EndEnumeration

Debug #somethingelse
Debug abc::xyz()  
If you are using modules from other authors, you can edit the source to implement this ;)
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
mestnyi
Addict
Addict
Posts: 1098
Joined: Mon Nov 25, 2013 6:41 am

Re: #PB_EventType_FirstCustomValue quetion

Post by mestnyi »

Code: Select all

DeclareModule FirstCustomValue
  Enumeration EventType #PB_EventType_FirstCustomValue
  EndEnumeration
EndDeclareModule
Module FirstCustomValue
EndModule

Enumeration FirstCustomValue::EventType
  #somethingelse
EndEnumeration

;\\
DeclareModule Module_1
  Enumeration FirstCustomValue::EventType
    #something
  EndEnumeration
EndDeclareModule
Module Module_1
EndModule

;\\
DeclareModule Module_2
  Enumeration FirstCustomValue::EventType
    #something
  EndEnumeration
EndDeclareModule
Module Module_2
EndModule


#somethingelse2 = Module_2::#something

Debug #somethingelse
Debug Module_1::#something
Debug #somethingelse2 ; Module_2::#something
Post Reply