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 8912885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:19:43+00:00 2026-06-15T04:19:43+00:00

I´m working on a CustomSlider Class. In my project I have three sliders which

  • 0

I´m working on a CustomSlider Class.
In my project I have three sliders which all have the class CustomSlider.
I want these three sliders to have different knobs. See Picture.

Since the sliders already have tags I decided to use them for this purpose.
Unfortunately I don´t see how to get tag value of the NSSliderCell.

I tried this:

int myTag = [self tag];

and this:

NSButton *button = [super self];
int myTag = [button tag];

Both without success, any idea?
Is there another way to let the class know which object is sending the message?

Greetings, Ronald

enter image description here

  • 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-15T04:19:45+00:00Added an answer on June 15, 2026 at 4:19 am

    The tag is a long. NSSliderCells inherit their tag from NSActionCell, so have a tag separate from the NSSlider which uses the NSSliderCell, which inherits its tag from NSControl. In a custom NSSliderCell class, [self tag] does return the tag set for the sliderCell in the XIB.

    Here is the header for a custom slider cell class:

    #import <AppKit/AppKit.h>
    @interface EWSliderCell : NSSliderCell
    @end
    

    and here is the whole of the class itself:

    #import "EWSliderCell.h"
    @implementation EWSliderCell
    -(NSRect)rectOfTickMarkAtIndex:(NSInteger)index {
        static BOOL reportedTag;
        if (!reportedTag) {
            long myTag = [self tag];
            NSLog(@"myTag=%ld", myTag);
            reportedTag = TRUE;
        }
        return CGRectMake(0.0, 0.0, 0.0, 0.0); // remove the tick marks from the slider
    }
    @end
    

    and this does execute and report the correct tag.

    I’m not able to replicate the error message you report. However, if I (erroneously) write myTag = [EWSliderCell tag]; then I see the message “No known class method for selector ‘tag’. tag is not a class method, it’s an instance method. (Is that the right word?) Can you post the code which produced the error message?

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

Sidebar

Related Questions

Working on three different computers at two different locations, on projects that are in
Working on an old Kohana 2 project and I want to link two models.
Working on a project where I have more or less carte blanche to modify
Working on a project with git, I have two feature branches, call them dev-a
Working on a project, I have this issue where my array slicetable returns undefined
Working with Sharepoint 2010, I have a class that inherits SPPersistedObject with various settings:
Working on a project at the moment and we have to implement soft deletion
Working in Scala-IDE, I have a Java library, in which one of the methods
Working with Reporting Services 2008 r2. So here's my issue: We have 5 reports
Working on the problems on Project Euler to try to learn Clojure. I'm on

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.