Questions tagged [nscontrol]

NSControl is an abstract superclass that provides three fundamental features for implementing user interface devices: drawing devices on the screen, responding to user events, and sending action messages. It works closely with the NSCell class.

60 questions
1
vote
1 answer

NSCell Subclassing: Draw NSProgressIndicator?

I am using a cell-based NSTableView. Is there any way to create a custom NSCell subclass and draw a NSProgressIndicator in it? Something similar to: -(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView{ [myProgressControl…
user2354690
1
vote
2 answers

NSSegmentedControl programmatically highlight segment

I have a NSSegmentedControl in which, upon user's click, some conditions should be met before the action is sent to its target. Till now i managed to do this, by overriding the -mouseDown event handler and invoking the segmentedControl's [super…
user4096537
1
vote
0 answers

NSTextfield.sendAction does not invoke function

I've been trying to invoke a function in a Swift Cocoa application when a user enters something in any NSTextField. The NSTextField's are generated at runtime. Here is my attempt: func OnUserInput(sender:…
Django
  • 5
  • 4
1
vote
1 answer

All controls disabled in title-less window

In my app I've got a secondary NSWindow that's created from .xib in my NSWindowController in my initWithWindowNibName: method. The window is a plain NSWindow with the title bar switched off. After creating the window it's shown using…
ATV
  • 4,116
  • 3
  • 23
  • 42
1
vote
0 answers

NSTextField dragging values

I am trying to create a text field in the Mac OSX environment that allows a user to select a number and drag horizontally to adjust that number up and down. I know this can be done because Apple have implemented it in the inspector panel of the…
Steffan
  • 200
  • 5
1
vote
2 answers

Coordinating a pair of NSTextField controls

I have a window with two NSTextField controls whose values must be kept in sync with one another. Specifically, one is width and the other is length and the ratio of them should remain equal to a given aspect ratio. I want the user to be able to…
MikeMayer67
  • 570
  • 6
  • 17
1
vote
1 answer

-(BOOL)trackMouse:inRect:ofView:untilMouseUp: Is never invoked

I have subclassed NSControl to get my custom control, have subclassed NSCell to get my custom cell, over overridden -(BOOL)trackMouse:inRect:ofView:untilMouseUp and necessary methods in custom cell, have overridden +…
Suhas Aithal
  • 842
  • 8
  • 20
1
vote
0 answers

Proper NSActionCell programming

I'm having trouble finding information about custom controls and cells. My control should have multiple NSCells, which is why I can't use the default NSControl. The Cell is being displayed correctly. However, they are NSButtonCells, and should…
IluTov
  • 6,807
  • 6
  • 41
  • 103
1
vote
1 answer

NSControl and NSCell: Manage the cell state the right way

I have a totally custom NSControl with its totally custom NSCell. Now I want to implement some Mouse interaction. For example when user clicks over the control I want to change the control state to highlight so the questions are: 1) Where I have…
MatterGoal
  • 16,038
  • 19
  • 109
  • 186
1
vote
2 answers

NSComboBox action selector fires when setHidden:YES

I have an NSComboBox. I've set an action selector. When the box gets hidden the selector fires, even if the user never touched it. Yes, I need to hide it. IBOutlet NSComboBox *comboBox; [comboBox setAction:@selector(onComboBoxSelection:)]; -…
estobbart
  • 1,137
  • 12
  • 28
1
vote
0 answers

How to get title of NSButtonCell in delegate method of NSOutlineView

I am using NSButtonCell subclass to display checkbox , image and label in same cell. Now i want to edit label in outlineView on double click or on enter key. NSButtonCell subclass: - (void)dealloc { [image release]; image = nil; [super…
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
1
vote
2 answers

ControlTextDidChange not working for setting string of NSTextField

I'm trying to find a method that monitors the text of NSTextField for changes. I tried the delegate method of -(void)controlTextDidChange:(NSNotification *)obj but it only works when the user types into the text field. If the text field string is…
wigging
  • 8,492
  • 12
  • 75
  • 117
0
votes
0 answers

How do I automatically reduce the width of an NSPopUpButton to the currently shown text's width?

I have an NSPopUpButton that, by default, is as wide as necessary to fit the widest text in its menu. Now I need the control to resize itself depending on the currently chosen (shown) menu item. For example, if the menu contains A XXXXXXXXXX And…
Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
0
votes
0 answers

How can I auto populate other textfields while a user edits first textfield?

I am building a macOS app with multiple text fields. While a user is editing the first text field, I want all the other text fields to autopopulate (according to the int value of the first text field). So far, I can auto-populate the fields when the…
Zara
  • 1
  • 1
0
votes
1 answer

Change contentTintColor on mouseDown for NSButton

I have a custom button that subclasses NSButton. I want to change the content tint color when the button is in pressed state. This is what I have: open override func mouseDown(with event: NSEvent) { // update contentTintColor …
manchiu
  • 3
  • 2