How is the private range for custom event types?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

How is the private range for custom event types?

Post by STARGÅTE »

I want to send with PostEvent() a custom EventType(), how is the private range for custom event types?
For Events we have #PB_Event_FirstCustomValue, is there any like #PB_EventType_FirstCustomValue?

Code: Select all

PostEvent(#PB_Event_Gadget, Window, Gadget, #MyEventTypeForUpdate)
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: How is the private range for custom event types?

Post by jassing »

STARGÅTE wrote:I want to send with PostEvent() a custom EventType(), how is the private range for custom event types?
For Events we have #PB_Event_FirstCustomValue, is there any like #PB_EventType_FirstCustomValue?

Code: Select all

PostEvent(#PB_Event_Gadget, Window, Gadget, #MyEventTypeForUpdate)
I may not understand your question... but:
You would need enumerate

Code: Select all

Enumeration #PB_Event_FirstCustomValue
  #MyEventTypeForUpdate
  #MyOtherEventType
.. etc ..
EndEnumeration
The problem with this is that each time you use a new/different compiler, you may need to recompile all your project (dll's, exe's etc) as "#PB_Event_FirstCustomValue" may change. (ie: if you rebuild an exe, a dll that posts your custom event will now post the 'wrong' event; that is, unless you rebuild the dll too)
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: How is the private range for custom event types?

Post by freak »

The highest event type we currently have is 65549 iirc (a canvas event). If you use the range 1048576 ($100000 in hex) and up you should be safe.

We should probably add a constant for that as well.
quidquid Latine dictum sit altum videtur
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: How is the private range for custom event types?

Post by jassing »

freak wrote:The highest event type we currently have is 65549 iirc (a canvas event). If you use the range 1048576 ($100000 in hex) and up you should be safe.

We should probably add a constant for that as well.
I had suggested setting aside a block for user-defined... but using a high value didn't occur to me;Mostly because it seems using #'s out of sequence for everything else is 'bad form' and 'wastes space' -- I can't find the reference that suggested it was inefficient to skip a whole bunch of gadget #'s; but I swear I read it.. somewhere ;-)

Thanks
-j
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: How is the private range for custom event types?

Post by STARGÅTE »

freak wrote:The highest event type we currently have is 65549 iirc (a canvas event). If you use the range 1048576 ($100000 in hex) and up you should be safe.

We should probably add a constant for that as well.
thx
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: How is the private range for custom event types?

Post by luis »

jassing wrote:Mostly because it seems using #'s out of sequence for everything else is 'bad form' and 'wastes space' -- I can't find the reference that suggested it was inefficient to skip a whole bunch of gadget #'s; but I swear I read it.. somewhere ;-)
In this case is different, these are just constants used to identify a message, only problem here can be a conflict in the numbering.
What you are referring to are indexes for PB objects, it has been mentioned many times in the forum but it's mentioned the manual too, maybe you have read it here -> http://www.purebasic.com/documentation/ ... jects.html
"Have you tried turning it off and on again ?"
A little PureBasic review
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: How is the private range for custom event types?

Post by jassing »

luis wrote:times in the forum but it's mentioned the manual too, maybe you have read it here ->
I've read a lot -- thanks. it's still ingrained in thinking -- My request was to 'block off' a few hundred so we could know they'd "always be private". Even with the huge # - we dont' know, since PB sometimes relies on host os's constants.... but thanks.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: How is the private range for custom event types?

Post by Fred »

#PB_EventType_FirstCustomValue added
Post Reply