Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MarkHamilton

macrumors newbie
Original poster
Jun 21, 2005
12
0
Albuquerque, NM, USA
I'm trying to figure out how to use the Little Arrows control in a Carbon app, but the documentation on this control is somewhat lacking. I created a simple app - a single window with a single Little Arrows control it, and an event handler hung on the " {kEventClassControl, kEventControlHit}" event for the control.

All the event handler does it print out which arrow was hit, and the minimum, maximum, and current value each time the control is hit. The code all seems to work, but the control value never changes. I've tried calling the next event handler both before and after the switch statement, but that makes no difference. What am I missing (other than usable documentation :( )?


Code:
   CallNextEventHandler( inHandler, event );

    what_happened = GetEventKind(event);
    switch (what_happened)
        {
        case kEventControlHit:
            GetEventParameter (event, kEventParamDirectObject, typeControlRef, NULL, sizeof(cref), NULL, &cref);
            GetControlID(cref, &cid);

            status = GetEventParameter (event, kEventParamControlPart, typeControlPartCode, NULL, sizeof (code), NULL, &code);
            require_noerr(status, CantGetEventParameter);
            if (code == kControlUpButtonPart)
                fprintf(stderr, "Up button\n");
            else if (code == kControlDownButtonPart)
                fprintf(stderr, "Down Button\n");
            else
                fprintf(stderr, "Unknown control part %i\n", code);

            fprintf(stderr, "value: %li\n", GetControl32BitValue(cref));
            fprintf(stderr, "min  : %li\n", GetControl32BitMinimum(cref));
            fprintf(stderr, "max  : %li\n", GetControl32BitMaximum(cref));

            break;
        };
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.