[ROOT] WidgetMessageTypes

From: Christian Lackas (delta@lackas.net)
Date: Mon Apr 23 2001 - 14:08:49 MEST


Hello Rooters,

I have a question concerning WidgetMessageTypes:
The "documentation" says:
| ROOT reserves all message ids
| between 0 - 1000. User defined messages should be in the range
| 1001 - 10000. Sub-messages must always be in the range 1-255.

but the code also casts message ids (MSG) to the range of 1-255 (i.e. I
can't use user defined messages):

inline Int_t GET_MSG(Long_t val)    { return Int_t((val >> 8) & 255); }
inline Int_t GET_SUBMSG(Long_t val) { return Int_t(val & 255); }

I've attached a path to root/inc/gui/WidgetMessageTypes.h.

Other API's (e.g. Windows) also include a symbol representing the lowest
user defineable value. So that you can generate your message ids
relative to this value, e.g.

const EWidgetMessageTypes kC_MYWIDGET = kC_USER +
(EWidgetMessageTypes)42;

Just in case the systems needs more than 1000 messages somewhere along
the way.

Regards,
 Christian Lackas


-- 
http://www.lackas.net/

Index: WidgetMessageTypes.h
===================================================================
RCS file: /user/cvs/root/gui/inc/WidgetMessageTypes.h,v
retrieving revision 1.4
diff -u -r1.4 WidgetMessageTypes.h
--- WidgetMessageTypes.h	2000/10/22 19:28:58	1.4
+++ WidgetMessageTypes.h	2001/04/23 11:47:56
@@ -67,6 +67,7 @@
       kTXT_OPEN           = 6,
       kTXT_CLOSE          = 7,
       kTXT_SAVE           = 8,
+   kC_USER             = 1001,
    kC_MSGMAX           = 10000
 };
 
@@ -74,7 +75,7 @@
 // Message cracking routines
 inline Int_t MK_MSG(EWidgetMessageTypes msg, EWidgetMessageTypes submsg)
                                    { return (msg << 8) + submsg; }
-inline Int_t GET_MSG(Long_t val)    { return Int_t((val >> 8) & 255); }
+inline Int_t GET_MSG(Long_t val)    { return Int_t(val >> 8); }
 inline Int_t GET_SUBMSG(Long_t val) { return Int_t(val & 255); }
 
 #endif



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:43 MET