eventcallback - Motif

This is a discussion on eventcallback - Motif ; I have a program that is opening three windows with Inventor. I am trying to run an EventCallback function that reads keystrokes and am having no luck. I have created a new SoEventCallback and added the child and such, but ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: eventcallback

  1. eventcallback

    I have a program that is opening three windows with Inventor. I am
    trying to run an EventCallback function that reads keystrokes and am
    having no luck. I have created a new SoEventCallback and added the
    child and such, but still no luck. I have it set up so that it should
    print something to the screne when there is a keyboard event, and it is
    not printing. Any suggestions.

    Andy


  2. Re: eventcallback


    Andrew Nash wrote:
    > I have a program that is opening three windows with Inventor. I am
    > trying to run an EventCallback function that reads keystrokes and am
    > having no luck. I have created a new SoEventCallback and added the
    > child and such, but still no luck. I have it set up so that it

    should
    > print something to the screne when there is a keyboard event, and it

    is
    > not printing. Any suggestions.


    Just a reminder - events are only sent to the scene graph (where an
    SoEventCallback node can see them) when the viewer is in selection
    mode (i.e. when you *don't* have the "hand" cursor). If you need
    to get events all the time you can use the setEventCallback method
    on the viewer class (but note that it returns raw system events).

    -Mike
    Mercury/TGS http://www.mc.com/tgs


  3. Re: eventcallback

    Thank you for the quick response, but I think I should be a little more
    descriptive. We are using three motif SoXt windows. The code we have so
    far is as follows:

    void eventCB(void *data, SoEventCallback *node);
    SoEventCallback *event = new SoEventCallback();
    event->addEventCallback(SoKeyboardEvent::getClassTypeId() ,eventCB,NULL);
    root->addChild(event);

    static void eventCB(void *data, SoEventCallback *node) {
    if (SO_KEY_PRESS_EVENT(node->getEvent(), UP_ARROW )) {// UP_ARROW))
    {
    printf("I hit the up arrow\n");
    }
    if (SO_KEY_PRESS_EVENT(node->getEvent(),DOWN_ARROW)) {
    printf("I hit the down arrow \n");
    }
    }

    This is the order that it appears in the code. So when the up or down arrow
    is pressed, nothing is printed. This is just a test to see if it is
    working. More complex operations will be taking the printf's place once we
    get it to work. Thank you for your help.

    Andy




    "MikeHeck" wrote in message
    news:1108487535.681368.39170@c13g2000cwb.googlegro ups.com...
    >
    > Andrew Nash wrote:
    >> I have a program that is opening three windows with Inventor. I am
    >> trying to run an EventCallback function that reads keystrokes and am
    >> having no luck. I have created a new SoEventCallback and added the
    >> child and such, but still no luck. I have it set up so that it

    > should
    >> print something to the screne when there is a keyboard event, and it

    > is
    >> not printing. Any suggestions.

    >
    > Just a reminder - events are only sent to the scene graph (where an
    > SoEventCallback node can see them) when the viewer is in selection
    > mode (i.e. when you *don't* have the "hand" cursor). If you need
    > to get events all the time you can use the setEventCallback method
    > on the viewer class (but note that it returns raw system events).
    >
    > -Mike
    > Mercury/TGS http://www.mc.com/tgs
    >




+ Reply to Thread