WindowRef from jitter ctxt & patcher in Max6


    Nov 08 2011 | 12:41 pm
    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);
    }

    • Feb 13 2012 | 5:21 pm
      Hi oli,
      do you released now a Max6 version of your very usefull ol.mousewheel object ?
    • Feb 13 2012 | 5:51 pm
      No... Jit.window reports mouse wheel messages in max6 which meant I didnt need an extra object
    • Feb 13 2012 | 6:12 pm
      Ok, i didn't know that,
      do you know how to report mouse wheel messages in a simple patcher Window context ?
      Thanks.
    • Feb 14 2012 | 11:09 pm
      No sorry, didn't work it out yet