cocoa cursor question

Discussion in 'Mac Programming' started by FredAkbar, Feb 28, 2007.

  1. FredAkbar macrumors 6502a


    Jan 18, 2003
    Santa Barbara, CA
    So I've got my graphic+text-adventure app set up so that when the cursor is in the graphic area, a custom cursor icon is used. The only issue at the moment is that when the game prints text (the NSTextView is next to the NSImageView (actually my own PSImageView, to be precise)), the cursor reverts to the regular arrow.

    My text-printing method is this:

    - (void)showIt:(NSString *)outputString
       NSRange selectionRange = NSMakeRange([[txtView textStorage] length], 0);
       [txtView setEditable:YES];
       [txtView setSelectedRange:selectionRange];
       [txtView insertText:outputString];
       [txtView setEditable:NO];
    And through trial and error, I narrowed it down to the two setEditable calls; one of them alone is ok, but having both, regardless of the code between them, messes up the cursor. E.g., simply setting it editable and printing the text is fine; it's the follow-up setEditable:NO that changes the cursor. What's the fix for this? I tried putting [cursor set] (where cursor is my custom cursor) at the end of that, but that didn't work.

    edit: I got help from a guy on Apple's cocoa-dev mailing list and have since fixed the issue. The problem was with how I was telling the image view to use the cursor.

Share This Page