home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
CHKEVENT.PRG
< prev
next >
Wrap
Text File
|
1993-05-11
|
3KB
|
108 lines
// chkevent.prg - check/handle events
//
// Written by: John M. Skelton, 27-Aug-92.
//
// Copyright (C) 1992 Skelton Software, Kendal Cottage, Hillam, Leeds LS25 5HP, UK.
// All Rights Reserved.
#include "windows.ch"
external errorsys // remove this if you don't want it!
function ChkEvent() // --> nEvent
local ev, hWnd, hMenu, nId
do while .t.
ev = _ChkEvent()
if ev == EVENT_NONE
exit
endif
// can do mapping in here
if ev == EVENT_MENU
// handle menu selection immediately
SelectWindow(hWnd := _LasthWnd())
ExecuteMenu(hWnd, _LastwParam())
elseif ev == EVENT_ACCELKEY
if (hMenu := GetMenu(hWnd := _LasthWnd())) == nil
// hWnd has no menu, try to default
hMenu = GetMenu()
hWnd = nil
endif
if hMenu != nil ;
.and. GetMenuId(hMenu, nId := _LastwParam()) != nil
// handle menu selection immediately
SelectWindow(hWnd)
ExecuteMenu(hWnd, nId)
else
// an accelerator, but not for any obvious menu
exit // return the event to the caller
endif
// elseif ev == ...
// // ...
else
exit
endif
enddo
//
// At this point, _LastMsg(), _LastwParam() and _LastlParam(), together
// with the other functions mentioned, have other useful information,
// as follows:
//
// event type: other info:
//
// EVENT_KEY inkey() the keystroke
//
// EVENT_LCLICK MouseX(), MouseY() the x,y position
// MouseRow(), MouseCol() the row,col position
// EVENT_LDBLCLK \
// EVENT_RCLICK \
// EVENT_RDBLCLK >--- see EVENT_LCLICK
// EVENT_MCLICK /
// EVENT_MDBLCLK /
//
// EVENT_REDRAW none; just re-draw the client area
//
// EVENT_SETFOCUS none; window is being given input focus
//
// EVENT_KILLFOCUS none; window is losing input focus
//
// EVENT_WINMOVE _LastLolParam() is the x position
// _LastHilParam() is the y position
//
// EVENT_WINSIZE _LastLolParam() is the new width in pixels
// _LastHilParam() is the new height in pixels
//
// EVENT_CONTROL _LastwParam() the control's id
//
// EVENT_HSCROLL _LastwParam() the scrollbar code
// (one of the SB_* values)
//
// EVENT_VSCROLL _LastwParam() the scrollbar code
// (one of the SB_* values)
return ev
function Event()
local ev := _LastEvent()
// can do mapping in here
return ev
// mouse X when click occurred - now written in C
//function MouseX()
//return _LastLolParam()
// mouse Y when click occurred - now written in C
//function MouseY()
//return _LastHilParam()
// Also: MouseRow() and MouseCol() give row and col position