Page 1 of 1

#PB_EventType_FirstCustomValue quetion

Posted: Fri May 31, 2024 4:08 am
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()

Re: #PB_EventType_FirstCustomValue quetion

Posted: Fri May 31, 2024 4:25 am
by jacdelad
Common module. I stumbled across this too.
https://www.purebasic.fr/english/viewto ... 16#p617116

I still find this confusing...

Re: #PB_EventType_FirstCustomValue quetion

Posted: Fri May 31, 2024 4:29 am
by jassing
Less than ideal. Requires a modicum of cooperation not always easy, or reliable.

Re: #PB_EventType_FirstCustomValue quetion

Posted: Fri May 31, 2024 6:44 am
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 ;)

Re: #PB_EventType_FirstCustomValue quetion

Posted: Fri May 31, 2024 7:26 am
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