Search code examples
functional-programmingmouseeventracket

is it possible to get mouse event directly without on-mouse in racket?


I am badly in a need to use mouse-events directly

Is it possible to get the mouse-event without using big bang ?

i.e I want to build a function like the following:

(define (check-if-button-down mev) (mouse=? mev "button-down"))

But for getting mev, the input is being fed from on-mouse of bigbang

About me : I am new to racket programming


Solution

  • Short answer: not really.

    However: the big bang model calls your mouse event handler when a mouse event occurs, so if you want to know whether the mouse button is pressed, your world state should include a boolean indicating whether the mouse button is pressed, and your mouse event handler should return a world state that updates this boolean correctly.

    Is there some reason this architecture doesn't work for you?