[archive] Using the Mouse Wheel to scroll within Paged Grids

[Migrated content. Thread originally posted on 28 July 2010]

I'm trying to implement the Mouse Wheel in my Paged Grids.
I service the event(s) and Modify the grid field to with Action-Next or Action-Previous, and that seems to work OK.

I enhanced it so the if the operator holds the Ctrl Key while wheeling, then I Modify the grid field Performing the logic 4 times. That works .... except if I really spin it, I end up getting a "Perform Stack Overflow" error. I'm guessing the Wheel Spin events are coming so fast, my grid display logic is not keeping up, and a race condition is occurring.

So I try to use the EVENT-LIST along with EXCLUDE-EVENT-LIST to disable and enable the MSG-PAGED-NEXT/PREV-WHEEL events, and the "Stack overflow" errors go away, ..... but all other events associated to the grid are also disabled.

Here is the coding:

GRIDLKUP-EVENT-HANDLER.
EVALUATE EVENT-TYPE
WHEN MSG-GOTO-CELL PERFORM IDENTIFY-OP-SELECTED-CELL
WHEN MSG-GOTO-CELL-MOUSE PERFORM IDENTIFY-OP-SELECTED-CELL
WHEN MSG-PAGED-FIRST PERFORM SCROLL-FIRST-GRID-DISPLAY-PAGE
WHEN MSG-PAGED-LAST PERFORM SCROLL-LAST-GRID-DISPLAY-PAGE
WHEN MSG-PAGED-NEXT PERFORM SCROLL-NEXT-GRID-DISPLAY-ITEM
WHEN MSG-PAGED-PREV PERFORM SCROLL-PRIOR-GRID-DISPLAY-ITEM
WHEN MSG-PAGED-NEXT-WHEEL PERFORM WHEEL-SCROLL-FORWARDS
WHEN MSG-PAGED-PREV-WHEEL PERFORM WHEEL-SCROLL-BACKWARDS
WHEN MSG-HEADING-DBLCLICK PERFORM RESELECT-DISPLAY-SEQUENCE
WHEN MSG-BEGIN-ENTRY PERFORM OP-IS-TRYING-TO-EDIT-CELL
WHEN MSG-FINISH-ENTRY PERFORM RESET-OP-EDIT-CELL-ATTEMPT
WHEN MSG-GRID-RBUTTON-DOWN PERFORM IDENTIFY-CELL-FOR-POPUP-MENU
WHEN MSG-GRID-RBUTTON-UP PERFORM SHOW-CELL-POPUP-MENU
END-EVALUATE.



WHEEL-SCROLL-FORWARDS.
PERFORM DISABLE-MOUSE-WHEEL-EVENTS.
EVALUATE EVENT-DATA-1
WHEN ZERO MODIFY GRIDLKUP-GD-1-Screen ACTION = ACTION-NEXT
WHEN 4 MOVE ZERO TO CUSTOMER-FILE-STATUS
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 4 OR (CUSTOMER-FILE-STATUS NOT = I-O-OK)
MODIFY GRIDLKUP-GD-1-Screen ACTION = ACTION-NEXT
END-PERFORM
END-EVALUATE.
PERFORM REENABLE-MOUSE-WHEEL-EVENTS.

WHEEL-SCROLL-BACKWARDS.
PERFORM DISABLE-MOUSE-WHEEL-EVENTS.
EVALUATE EVENT-DATA-1
WHEN ZERO MODIFY GRIDLKUP-GD-1-Screen ACTION = ACTION-PREVIOUS
WHEN 4 MOVE ZERO TO CUSTOMER-FILE-STATUS
PERFORM VARYING I FROM 1 BY 1 UNTIL I > 4 OR (CUSTOMER-FILE-STATUS NOT = I-O-OK)
MODIFY GRIDLKUP-GD-1-Screen ACTION = ACTION-PREVIOUS
END-PERFORM
END-EVALUATE.
PERFORM REENABLE-MOUSE-WHEEL-EVENTS.

DISABLE-MOUSE-WHEEL-EVENTS.
MODIFY GRIDLKUP-GD-1-Screen EVENT-LIST IS (MSG-PAGED-NEXT-WHEEL MSG-PAGED-PREV-WHEEL).
MODIFY GRIDLKUP-GD-1-Screen EXCLUDE-EVENT-LIST IS 1.

REENABLE-MOUSE-WHEEL-EVENTS.
MODIFY GRIDLKUP-GD-1-Screen EVENT-LIST IS (MSG-PAGED-NEXT-WHEEL MSG-PAGED-PREV-WHEEL).
MODIFY GRIDLKUP-GD-1-Screen EXCLUDE-EVENT-LIST IS 0.




Has anyone had this problem, and able to indicate how to fix it ?

Thanks