A procedure which returns the Event() ID as the Equate. Handy for debugview output

If you need to show the Event() id, in debugview, this procedure can translate it to the Equate name.

     map
     EventDesc Procedure(Long pEvent),String
     End
EventDesc            PROCEDURE  (Long pEvent)              ! Declare Procedure
Loc:RVString        String(40)
  CODE
!(Long pEvent),String

    Case pEvent

    OF EVENT:Accepted
        Loc:RVString    = 'EVENT:Accepted'

    OF EVENT:NewSelection
        Loc:RVString    = 'EVENT:NewSelection'

    OF EVENT:ScrollUp
        Loc:RVString    = 'EVENT:ScrollUp'

    OF EVENT:ScrollDown
        Loc:RVString    = 'EVENT:ScrollDown'

    OF EVENT:PageUp
        Loc:RVString    = 'EVENT:PageUp'

    OF EVENT:PageDown
        Loc:RVString    = 'EVENT:PageDown'

    OF EVENT:ScrollTop
        Loc:RVString    = 'EVENT:ScrollTop'

    OF EVENT:ScrollBottom
        Loc:RVString    = 'EVENT:ScrollBottom'

    OF EVENT:Locate
        Loc:RVString    = 'EVENT:Locate'

    OF EVENT:MouseDown
        Loc:RVString    = 'EVENT:MouseDown'

    OF EVENT:MouseUp
        Loc:RVString    = 'EVENT:MouseUp'

    OF EVENT:MouseIn
        Loc:RVString    = 'EVENT:MouseIn'

    OF EVENT:MouseOut
        Loc:RVString    = 'EVENT:MouseOut'

    OF EVENT:MouseMove
        Loc:RVString    = 'EVENT:MouseMove'

    OF EVENT:VBXevent
        Loc:RVString    = 'EVENT:VBXevent'

    OF EVENT:AlertKey
        Loc:RVString    = 'EVENT:AlertKey'

    OF EVENT:PreAlertKey
        Loc:RVString    = 'EVENT:PreAlertKey'

    OF EVENT:Dragging
        Loc:RVString    = 'EVENT:Dragging'

    OF EVENT:Drag
        Loc:RVString    = 'EVENT:Drag'

    OF EVENT:Drop
        Loc:RVString    = 'EVENT:Drop'

    OF EVENT:ScrollDrag
        Loc:RVString    = 'EVENT:ScrollDrag'

    OF EVENT:TabChanging
        Loc:RVString    = 'EVENT:TabChanging'

    OF EVENT:Expanding
        Loc:RVString    = 'EVENT:Expanding'

    OF EVENT:Contracting
        Loc:RVString    = 'EVENT:Contracting'

    OF EVENT:Expanded
        Loc:RVString    = 'EVENT:Expanded'

    OF EVENT:Contracted
        Loc:RVString    = 'EVENT:Contracted'

    OF EVENT:Rejected
        Loc:RVString    = 'EVENT:Rejected'

    OF EVENT:DroppingDown
        Loc:RVString    = 'EVENT:DroppingDown'

    OF EVENT:ScrollTrack
        Loc:RVString    = 'EVENT:ScrollTrack'

    OF EVENT:DroppingDown
        Loc:RVString    = 'EVENT:DroppingDown'

    OF EVENT:ColumnResize
        Loc:RVString    = 'EVENT:ColumnResize'

    OF EVENT:Selected
        Loc:RVString    = 'EVENT:Selected'

    OF EVENT:Selecting
        Loc:RVString    = 'EVENT:Selecting'

    OF EVENT:CloseWindow
        Loc:RVString    = 'EVENT:CloseWindow'

    OF EVENT:CloseDown
        Loc:RVString    = 'EVENT:CloseDown'

    OF EVENT:OpenWindow
        Loc:RVString    = 'EVENT:OpenWindow'

    OF EVENT:OpenFailed
        Loc:RVString    = 'EVENT:OpenFailed'

    OF EVENT:LoseFocus
        Loc:RVString    = 'EVENT:LoseFocus'

    OF EVENT:GainFocus
        Loc:RVString    = 'EVENT:GainFocus'

    OF EVENT:Suspend
        Loc:RVString    = 'EVENT:Suspend'

    OF EVENT:GainFocus
        Loc:RVString    = 'EVENT:GainFocus'

    OF EVENT:Resume
        Loc:RVString    = 'EVENT:Resume'

    OF EVENT:Notify
        Loc:RVString    = 'EVENT:Notify'

    OF EVENT:Timer
        Loc:RVString    = 'EVENT:Timer'

    OF EVENT:DDErequest
        Loc:RVString    = 'EVENT:DDErequest'

    OF EVENT:DDEadvise
        Loc:RVString    = 'EVENT:DDEadvise'

    OF EVENT:DDEdata
        Loc:RVString    = 'EVENT:DDEdata'

    OF EVENT:DDEcommand
        Loc:RVString    = 'EVENT:DDEcommand'

    OF EVENT:DDEexecute
        Loc:RVString    = 'EVENT:DDEexecute'

    OF EVENT:DDEpoke
        Loc:RVString    = 'EVENT:DDEpoke'

    OF EVENT:DDEclosed
        Loc:RVString    = 'EVENT:DDEclosed'

    OF EVENT:DDEexecute
        Loc:RVString    = 'EVENT:DDEexecute'

    OF EVENT:DDEexecute
        Loc:RVString    = 'EVENT:DDEexecute'

    OF EVENT:DDEexecute
        Loc:RVString    = 'EVENT:DDEexecute'

    OF EVENT:Move
        Loc:RVString    = 'EVENT:Move'

    OF EVENT:Size
        Loc:RVString    = 'EVENT:Size'

    OF EVENT:Restore
        Loc:RVString    = 'EVENT:Restore'

    OF EVENT:Maximize
        Loc:RVString    = 'EVENT:Maximize'

    OF EVENT:Iconize
        Loc:RVString    = 'EVENT:Iconize'

    OF EVENT:Completed
        Loc:RVString    = 'EVENT:Completed'

    OF EVENT:Moved
        Loc:RVString    = 'EVENT:Moved'

    OF EVENT:Sized
        Loc:RVString    = 'EVENT:Sized'

    OF EVENT:Restored
        Loc:RVString    = 'EVENT:Restored'

    OF EVENT:Maximized
        Loc:RVString    = 'EVENT:Maximized'

    OF EVENT:Iconized
        Loc:RVString    = 'EVENT:Iconized'

    OF EVENT:Docked
        Loc:RVString    = 'EVENT:Docked'

    OF EVENT:Undocked
        Loc:RVString    = 'EVENT:Undocked'

    OF EVENT:BuildFile
        Loc:RVString    = 'EVENT:BuildFile'

    OF EVENT:BuildKey
        Loc:RVString    = 'EVENT:BuildKey'

    OF EVENT:BuildDone
        Loc:RVString    = 'EVENT:BuildDone'

    OF EVENT:User
        Loc:RVString    = 'EVENT:User'

    OF EVENT:Last
        Loc:RVString    = 'EVENT:Last'

    OF EVENT:DoResize
        Loc:RVString    = 'EVENT:DoResize'

    Else

        Loc:RVString    = pEvent

    End

    Return Clip(Loc:RVString)

There are many ways of doing this - here is mine for your consideration

 MAP
        MODULE('CwDebugging')
GetEventName                            PROCEDURE(*CSTRING pEventName, UNSIGNED pEventNumber),NAME('WslDebug$NameMessage'),RAW
        END
 END
 
GetEventName PROCEDURE  (UNSIGNED prmEvent=0, STRING prmFormat) !,STRING ! Declare Procedure
wEventName           CSTRING(31),AUTO                      !
wEventNameCW         STRING(12),AUTO                       ! Clarion
wEventNameWM         STRING(20),AUTO                       ! Windows
  CODE
!-
 prmEvent = CHOOSE(prmEvent = 0, EVENT(), prmEvent)
!-
 IF INSTRING('W',prmFormat,1,1)
    wEventName   = ''
    CASE prmEvent
      OF 0219H ; wEventName = 'WM_DEVICECHANGE'
      OF 0218H ; wEventName = 'WM_POWERBROADCAST'
    ELSE       ; GetEventName(wEventName, prmEvent)
    END
    wEventNameWM = CHOOSE(wEventName='', ShortToHex(prmEvent,False) & 'h', wEventName)
 END
!-
 IF INSTRING('C',prmFormat,1,1)
    wEventName   = ''

    CASE prmEvent
      OF EVENT:User     ; wEventName = 'EVENT:User'
      OF EVENT:DoResize ; wEventName = 'EVENT:DoResize'
    ELSE                ; GetEventName(wEventName, prmEvent + 0A000h)  !- Note: use CurrEvent + 0A000h ELSE will get WM_*
    END

    wEventName   = CLIP(wEventName)
    IF SUB(wEventName,1,6) = 'EVENT:'
           wEventName = wEventName [ 7 : LEN(wEventName) ]
    END
    wEventNameCW = CHOOSE(wEventName='', ShortToHex(prmEvent + 0A000h,False) & 'h', wEventName)
 END
!-
 IF    INSTRING('CW',prmFormat,1,1)
                     wEventName = wEventNameCW & '|' & wEventNameWM
 ELSIF INSTRING('C' ,prmFormat,1,1)
                     wEventName = wEventNameCW
 ELSIF INSTRING('W' ,prmFormat,1,1)
                     wEventName = wEventNameWM
 ELSE
                     wEventName = '? Fmt=' & prmFormat & ' Evt=' & ShortToHex(prmEvent,False)
                     RETURN wEventName
 END
!-
 IF INSTRING('H',prmFormat,1,1)
    wEventName = ShortToHex(prmEvent,False) & 'h' & ' ' & wEventName
 END
!-
 RETURN wEventName
!==============================================================================

You might be interested in \Clarion\LibSrc\win\ablwinr.clw

This is a new one on me.

I have this bare bones little function to return EVENT:xxxx from Event(). It should allow passing the Event/Message Number to allow use in subclass and API code. Not sure what it does with DoResize or User events.

ClaEventNameRTL PROCEDURE(*CSTRING OutName, LONG inEventPlusA000h),RAW,NAME('WslDebug$NameMessage'),DLL(dll_mode)

EventName PROCEDURE() !,String
M CSTRING(48),AUTO
E LONG,AUTO
CODE
  E=EVENT()
  IF ~E THEN RETURN ''.
  ClaEventNameRTL(M,E+0A000h)
  IF ~M THEN
     ClaEventNameRTL5(M,E) !try for WM_
     IF ~M THEN M='Event#' & E.
  END
  RETURN M

Good idea to handle EVENT:User, but it’s not a single value its a range. E.g. you may see code like

EVENT:BlargRefresh EQUATE(EVENT:User + 1)
EVENT:BlargDisable EQUATE(EVENT:User + 2)
EVENT:BlargEnable  EQUATE(EVENT:User + 3)

AFAIK the max User range is not defined in Help or Equates. That would be nice to do @RZaunere
Edit: there is an Event:Last but I don’t have the r
Equates file to see the value.

User seems similar to API message WM_User. That has a range of 0400h to 7FFFh, above that are reserved. The Clarion Events start at A000h so are in that WM_User range and must end at 7FFF.

But API has Message WM_APP that overlaps User and is in the range 8000h - BFFFh. So Clarion Events are in that range. From C000h - 7FFFh is for Registered message.

So you might code a range this way so it shows the User + #:

    CASE prmEvent
      OF EVENT:User     ; wEventName = 'EVENT:User'
      OF EVENT:DoResize ; wEventName = 'EVENT:DoResize'
      OF EVENT:User 
      TO EVENT:User + (BFFFh-0A000h+1 - EVENT:User) !WM_APP max
              wEventName = 'EVENT:User + '& (prmEvent - EVENT:User)
    ELSE                ; GetEventName(wEventName, prmEvent + 0A000h)  !- Note: use CurrEvent + 0A000h ELSE will get WM_*
    END

This was done on my phone so untested and not sure my logic is correct. I would test Event:User + 1 with your current code to see what name the RTL function returns.