Kbase P25901: How to Apply Windows Level Events
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/27/2003 |
|
Status: Unverified
GOAL:
How to Apply Windows Level Events
FACT(s) (Environment):
Progress 9.1x
CAUSE:
When you need to "Make" an event in the Windows environment happen that Progress does not support you can use a direct call to Windows to apply the event. As an example here is a way for a program to make the popup menu of a widget appear.
FIX:
/*** define external procedure to send message **/
PROCEDURE SendMessage EXTERNAL "user.exe":
DEFINE INPUT PARAMETER win-handle AS SHORT.
DEFINE INPUT PARAMETER win-msg AS SHORT.
DEFINE INPUT PARAMETER win-param1 AS SHORT.
DEFINE INPUT PARAMETER win-param2 AS LONG.
END.
/*** define external procedure to set cursor position **/
PROCEDURE SetCursorPos EXTERNAL "user.exe":
DEFINE INPUT PARAMETER x-pos AS SHORT.
DEFINE INPUT PARAMETER y-pos AS SHORT.
END.
PROCEDURE drop-popup-menu :
/*--------------------------------------------------------------------
Purpose: Allows programmatic dropping of popup-menu for a widget
Parameters: Widget handle Notes: This is quite a workaround
and will need some testing.
RDG - WARNING, Hardcoded height pixel offset.
---------------------------------------------------------------------*/
DEFINE INPUT PARAMETER p-wh AS WIDGET-HANDLE NO-UNDO.
DEF VAR t-xpos AS INT NO-UNDO.
DEF VAR t-ypos AS INT NO-UNDO.
DEF VAR t-absx AS INT NO-UNDO.
DEF VAR t-absy AS INT NO-UNDO.
DEF VAR t-lparam AS INT NO-UNDO.
DEF VAR t-hdl AS INT NO-UNDO.
DEF VAR t-frmhdl AS WIDGET-HANDLE NO-UNDO.
ASSIGN
t-hdl = p-wh:HWND
t-frmhdl = p-wh:FRAME
t-xpos = p-wh:X + 2
t-ypos = p-wh:Y + 2
t-lparam = (t-ypos * 65536) + t-xpos /** y in high word, x in
low **/ t-absx = CURRENT-WINDOW:X + p-wh:X
+ p-wh:WIDTH-PIXELS - 2 /** positioning right side
**/
t-absy = CURRENT-WINDOW:Y + p-wh:Y
+ 285. /** Title, menubar etc. ??
**/
RUN SetCursorPos (INPUT t-absx, INPUT t-absy).
RUN SendMessage (INPUT t-hdl, INPUT 516, INPUT 2, INPUT t-lparam).
RUN SendMessage (INPUT t-hdl, INPUT 517, INPUT 0, INPUT t-lparam).
END PROCEDURE.
---- Code insert ends ----