Little Arrows control question

Discussion in 'Mac Programming' started by MarkHamilton, Jun 26, 2005.

  1. MarkHamilton macrumors newbie

    Joined:
    Jun 21, 2005
    Location:
    Albuquerque, NM, USA
    #1
    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;
            };
     
  2. MarkHamilton thread starter macrumors newbie

    Joined:
    Jun 21, 2005
    Location:
    Albuquerque, NM, USA
    #2
    Well, if no one has an answer, could someone suggest another venue for asking this question?
     

Share This Page