WindowRef from jitter ctxt & patcher in Max6

oli larkin's icon

I am trying to make my ol.mousewheel object work in Max6

previously I used this code to either get the frontmost Window handle or the window handle of a jitter context. Neither is working now. I am hoping I can still use my carbon event handler code to grab the mousewheel events, but I do not know get the windowref in the first place in Max6. I think it would be better to get the window of the patcher where the object is, rather than using FrontWindow();

any ideas?

thanks,

oli

void olmousewheel_start(t_olmousewheel *x)
{
    void *window;

    olmousewheel_stop(x);

    window = jit_object_findregistered(x->ctxt);
    if(window) jit_object_method(window, gensym("get_window_ptr"), &x->winRef);
    else x->winRef = FrontWindow(); //if no argument, get the patcher window

    x->eventHandlerRef = 0;

    const EventTypeSpec eventTypes[] =
    {
        { kEventClassMouse, kEventMouseWheelMoved },
    };

    static EventHandlerUPP handleWindowEventUPP = 0;

    if (handleWindowEventUPP == 0) handleWindowEventUPP = NewEventHandlerUPP (handleWindowEvent);

    InstallWindowEventHandler (x->winRef, handleWindowEventUPP,
                             GetEventTypeCount (eventTypes), eventTypes,
                             (t_olmousewheel *) x, &x->eventHandlerRef);
}

eliott paris's icon

Hi oli,
do you released now a Max6 version of your very usefull ol.mousewheel object ?

oli larkin's icon

No... Jit.window reports mouse wheel messages in max6 which meant I didnt need an extra object

eliott paris's icon

Ok, i didn't know that,
do you know how to report mouse wheel messages in a simple patcher Window context ?
Thanks.

oli larkin's icon

No sorry, didn't work it out yet