pointingHandCursor

  • Hi all,

    I've got an NSTextField. This field is filled with an
    NSAttributedString that contains a link to a website.
    When the mouse moves over this field I want the pointingHandCursor to
    be shown.

    My code in the WindowController:
    [[myTextField addCursorRect:[myTextField frame]  cursor:[NSCursor
    pointingHandCursor]];
    [[self window]enableCursorRects];

    Why doesn't this work? These statements have no effect at all, cursur
    is IBeamCursor over the NSTextField.

    Any ideas?
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • I would suggest having a look at the Sample Code section on the Apple
    Web site:

    http://developer.apple.com/samplecode/Sample_Code/Cocoa.htm

    There is a sample code named: "TextLinks" which is doing what you're
    trying to achieve. It's working really well.

    On Wednesday, December 3, 2003, at 10:44 AM, Ruben Smits wrote:

    > Hi all,
    >
    > I've got an NSTextField. This field is filled with an
    > NSAttributedString that contains a link to a website.
    > When the mouse moves over this field I want the pointingHandCursor to
    > be shown.
    >
    > My code in the WindowController:
    > [[myTextField addCursorRect:[myTextField frame]  cursor:[NSCursor
    > pointingHandCursor]];
    > [[self window]enableCursorRects];
    >
    > Why doesn't this work? These statements have no effect at all, cursur
    > is IBeamCursor over the NSTextField.
    >
    > Any ideas?
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
  • Thanks, this helps. The magic was to override the resetCursorRects.

    On 3-dec-03, at 12:29, Stephane Sudre wrote:

    > I would suggest having a look at the Sample Code section on the Apple
    > Web site:
    >
    > http://developer.apple.com/samplecode/Sample_Code/Cocoa.htm
    >
    > There is a sample code named: "TextLinks" which is doing what you're
    > trying to achieve. It's working really well.
    >
    > On Wednesday, December 3, 2003, at 10:44 AM, Ruben Smits wrote:
    >
    >> Hi all,
    >>
    >> I've got an NSTextField. This field is filled with an
    >> NSAttributedString that contains a link to a website.
    >> When the mouse moves over this field I want the pointingHandCursor to
    >> be shown.
    >>
    >> My code in the WindowController:
    >> [[myTextField addCursorRect:[myTextField frame]  cursor:[NSCursor
    >> pointingHandCursor]];
    >> [[self window]enableCursorRects];
    >>
    >> Why doesn't this work? These statements have no effect at all, cursur
    >> is IBeamCursor over the NSTextField.
    >>
    >> Any ideas?
    _______________________________________________
    cocoa-dev mailing list | <cocoa-dev...>
    Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
    Do not post admin requests to the list. They will be ignored.
previous month december 2003 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today