Page 1 of 1
Reserve block (100? 200?) for custom events.
Posted: Tue Jun 18, 2013 4:15 pm
by jassing
Currently, if I build a project that uses custom events with PostEvent(), I need to enumerate my events:
Code: Select all
Enumerate #PB_Event_FirstCustomValue
...
EndEnumerate
This works fine -- UNTIL (for example) a dll is modified with an updated purebasic version. It then stands the chance of having #PB_Event_FirstCustomValue be a different value; requiring an entire project to be rebuilt.
If there was a reserved block of 100 or 200 or other "Custom Event" #; it would help in the long run.
Perhaps:
#PB_Event_CustomReserve1... #PB_Event_CustomReserve200
and then have #PB_Event_FirstCustomValue remain available for more custom events and to not break current projects that use it.
Re: Reserve block (100? 200?) for custom events.
Posted: Tue Jun 18, 2013 4:48 pm
by BorisTheOld
I asked this question when 5.10 was released. Here's Fred's answer.
http://www.purebasic.fr/english/viewtop ... =postevent
It's unlikely that Fred will be changing the base value on a whim. But that said, there's always a risk that any PB feature can change in the future.
If you fret about all the things that might change, then you should quit now and take up a less stressful pastime.

Re: Reserve block (100? 200?) for custom events.
Posted: Tue Jun 18, 2013 5:09 pm
by ts-soft
Named Enumeration should solve this problem:
Code: Select all
Enumeration CustomEvent
#myfirst = #PB_Event_FirstCustomValue
#second
#third
EndEnumeration
;...
Enumeration CustomEvent
#second_enumeration
EndEnumeration
Debug #third
Debug #second_enumeration
http://www.purebasic.fr/english/viewtop ... 305#p53305
i think this one comes someday

Re: Reserve block (100? 200?) for custom events.
Posted: Wed Jun 19, 2013 4:59 am
by jassing
I'm not fretting, it's a wish list forum, no? I simply pointed out how it could be useful.
And no, named enumeration doesn't address the situation.
Re: Reserve block (100? 200?) for custom events.
Posted: Wed Jun 19, 2013 6:28 am
by BorisTheOld
jassing wrote:This works fine -- UNTIL (for example) a dll is modified with an updated purebasic version. It then stands the chance of having #PB_Event_FirstCustomValue be a different value; requiring an entire project to be rebuilt.
If there was a reserved block of 100 or 200 or other "Custom Event" #; it would help in the long run.
Perhaps:
#PB_Event_CustomReserve1... #PB_Event_CustomReserve200
and then have #PB_Event_FirstCustomValue remain available for more custom events and to not break current projects that use it.
Why request, say, 200 reserved events, and that #PB_Event_FirstCustomValue remain immutable?
Fred has already said that event numbers greater than 65536 (#PB_Event_FirstCustomValue) are reserved for custom events. So it seems to me that PB already has what you need.
And as for #PB_Event_FirstCustomValue changing in the future, the same argument could be made for any constant or feature already in PB -- including the fixed range that you request.
As I said, don't fret about it. I suspect that you'll need to recompile your programs because of your own upgrades, long before you need to recompile them because of changes to PB constants.