Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8644541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:19:08+00:00 2026-06-12T12:19:08+00:00

I have a NSTextField which is nested by a custom view and I want

  • 0

I have a NSTextField which is nested by a custom view and I want to change the default behavior of multiple clicks in a row (double click, tripple click etc.), similarly to the behavior of text nodes MindNode (see the image below).

I want the first click to “activate” the text field and then go on from the beginning (like reseting the click count of the event).

I have following ideas, but I don’t know how to implement them and if they actually make sense:

  • Somehow change the time using +[NSEvent doubleClickInterval] and slow down the second click.
  • Reduce the click count programmatically?
  • Make the NSTextField non-selectable using -hitTest:, forward the click to the superview, change some parameter of the text field and accept the next clicks. In this case, the click count of the second click is still 2.
  • Override -mouseDown: and not call super. This breaks the NSTextField’s selection functionality.

I hope there is an easier way to achieve this, which I have overlooked.

Thanks for your answers!

Here is a graphical representation of the problem:
Changing the behavior of multiple click for NSTextField

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:19:10+00:00Added an answer on June 12, 2026 at 12:19 pm

    I’ve solved it by subclassing NSTextField and decrementing click count of mouse down events programmatically. Using a boolean property of the subclass I am able to turn this special behavior on and off.

    - (void)mouseDown:(NSEvent *)theEvent
    {
        if (self.specialBehavior) {
            theEvent = [NSEvent mouseEventWithType:theEvent.type
                                          location:theEvent.locationInWindow
                                     modifierFlags:theEvent.modifierFlags
                                         timestamp:theEvent.timestamp
                                      windowNumber:theEvent.windowNumber
                                           context:theEvent.context
                                       eventNumber:theEvent.eventNumber
                                        clickCount:theEvent.clickCount - 1
                                          pressure:theEvent.pressure];
        }
    
        [super mouseDown:theEvent];
    }
    

    To simplify this long method call, I wrote a category method for NSEvent which decrements the click count of an event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom view with several NSTextField controls for which I want to
I have a NSTextField on the view of an NSCollectionViewItem . When you click
I have a custom view in a .xib file, which I use as the
I have a custom NSTextField sub-class with a custom drawRect: implementation. The text field
Have deployed numerous report parts which reference the same view however one of them
I have created a notes field designed to hold multiple paragraphs of text which
I have a NSTextField bound to my model. If I change the content of
I created a custom view, which has one button and one text field ,
I have a text field cell in a table view, from which I need
I have two NSTextfield, and I want to use the same method for each

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.