Page 1 of 1

How is the private range for custom event types?

Posted: Sun Jun 30, 2013 10:28 pm
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)

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

Posted: Sun Jun 30, 2013 11:19 pm
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)

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

Posted: Sun Jun 30, 2013 11:39 pm
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.

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

Posted: Mon Jul 01, 2013 1:40 am
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

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

Posted: Mon Jul 01, 2013 8:27 am
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

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

Posted: Mon Jul 01, 2013 12:56 pm
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

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

Posted: Tue Jul 02, 2013 12:02 am
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.

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

Posted: Tue Jul 02, 2013 9:26 am
by Fred
#PB_EventType_FirstCustomValue added