What is the best way to get events fired on keypress for an NSTextField?

2015-03-12 Thread Patrick J. Collins
I hooked up an action from IB to my view controller, but I don't see an option for where to define what kind of action it is... So my problem is events are only being fired when a textfield stops being edited. I would like it to fire anytime a key is pressed, What is the best way to do

Re: What is the best way to get events fired on keypress for an NSTextField?

2015-03-12 Thread Steve Mills
edited. I would like it to fire anytime a key is pressed, What is the best way to do this currently? I'm not aware of a way to do that. Have you tried subclassing NSTextfield and overriding keyDown, and calling the action handler from there? -- Steve Mills Drummer, Mac geek

Re: What is the best way to get events fired on keypress for an NSTextField?

2015-03-12 Thread Mike Abdullah
problem is events are only being fired when a textfield stops being edited. I would like it to fire anytime a key is pressed, What is the best way to do this currently? I'm not aware of a way to do that. Have you tried subclassing NSTextfield and overriding keyDown, and calling the action

Re: What is the best way to get events fired on keypress for an NSTextField?

2015-03-12 Thread Steve Mills
On Mar 12, 2015, at 12:15:32, Mike Abdullah mabdul...@karelia.com wrote: Please don’t do that. NSTextField already provides such messaging to its delegate:

What is the best way to determine what type of removable media is inserted? (ie: DMG)

2009-11-07 Thread Robert Monaghan
Hi Everyone, Is there a way to determine if a mounted removable volume is a DMG or not? I need to distinguish between a USB Stick and a DMG in my app. I have played with statfs(), but I can't seem to figure out a tangible/concrete difference. How does one figure out what type of removable

Re: What is the best way to determine what type of removable media is inserted? (ie: DMG)

2009-11-07 Thread Greg Guerin
Robert Monaghan wrote: How does one figure out what type of removable volume is mounted? Use the 'hdiutil' command to get info on dmg's. For example: hdiutil info or: hdiutil info -plist You can also correlate its output to statfs()-returned data. -- GG

Re: What is the best way to call parent view controller methods from within child view controller?

2009-09-20 Thread Jesse Armand
is the best way to accomplish this? Currently, I have a method in A that sets the title property value:        - (void) setBackBarButtonItemTitle:(NSString *)newTitle {            self.navigationItem.backBarButtonItem.title = newTitle;        } When in B, I call -viewControllers to get

Re: What is the best way to call parent view controller methods from within child view controller?

2009-09-20 Thread Jesse Armand
On Sun, Sep 20, 2009 at 6:37 PM, Jesse Armand mnemonic...@gmail.com wrote: You can create an ivar in class B that refer to class A instance. Set that ivar, when class B instance is created. So, you can call the methods in class A by using that instance, without searching through the view

What is the best way to call parent view controller methods from within child view controller?

2009-09-19 Thread Alex Reynolds
of the backBarButtonItem was initially set in A, just before I pushed the B view onto the navigation stack. Assuming I am in B and I would like to change the title of the backBarButtonItem, what is the best way to accomplish this? Currently, I have a method in A that sets the title property value

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-23 Thread Sean McBride
On 6/18/09 2:52 PM, Greg Guerin said: Chilton Webb wrote: Is there a way to add a tag an IB object in such a way that it is not visible to the user, but in such a way that I could reference it from my app? Maybe the -tag method: it returns a 32-bit integer.. It's settable in IB as the

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-19 Thread Graham Cox
On 19/06/2009, at 3:59 AM, Erik Buck wrote: use [[myBox subviews] makeObjectPerformSelector:@selector(setEnabled:) withObject:NO]; or similar. Are you certain that works? 'NO' isn't an object, so I didn't think you could use -makeObjectsPerformSelector:withObject: in this fashion -

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-19 Thread Graham Cox
On 19/06/2009, at 5:23 PM, Graham Cox wrote: However it does seem to compile without complaint, though I'm not sure why... If this is permitted, does it work with rects, points, etc? My bad - it doesn't even compile in fact, so I guess that answers that question. --Graham

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-19 Thread Erik Buck
It compiles because NO == nil == NULL == 0. I shouldn't have posted the silly example which doesn't work in most cases. how about this typed in mail: @interface NSView (MYGroupEnable) /// Enable all controls nested within the receiver - (void)enableSubviews { for(NSView *currentView in

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-19 Thread Chilton Webb
Hi, Here's why I'm asking. Right now I have an app that has a number of possibly different 'objects' in it. And I currently have a single inspector for all of them. When a new object is selected, the appropriate view for that object is added to the inspector window. This is a basically

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-19 Thread Andy Lee
If I understand correctly: * You want to have a single general-purpose model class (what you are calling the object) for which different object types might have different sets of attributes. Kind of like a dictionary or an NSManagedObject. * You'd like to use xib files to serve as attribute

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-19 Thread Graham Cox
On 20/06/2009, at 5:35 AM, Chilton Webb wrote: Hi, Here's why I'm asking. Right now I have an app that has a number of possibly different 'objects' in it. And I currently have a single inspector for all of them. When a new object is selected, the appropriate view for that object is

What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Chilton Webb
Hi, In an effort to create a less structured set of IB objects, I would like to 'tag' various IB elements. For example, I might want to add a specific tag to a group of objects that I might later want to show or hide. I might want to grab values from only objects that contain some key

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Erik Buck
See the - (void)setRepresentedObject:(id)anObject method of NSCell.  You can set a string or dictionary and the represented object and retrieve it via -representedObject.   You can also instantiate an array and add objects to the array within IB.  Then you only need an outlet instance variable

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Michael Ash
On Thu, Jun 18, 2009 at 1:59 PM, Erik Buckerik.b...@sbcglobal.net wrote: You can also instantiate an array and add objects to the array within IB.  Then you only need an outlet instance variable to reference the array and not separate instance variables for all of the user interface objects. 

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Kyle Sluder
On Thu, Jun 18, 2009 at 1:45 PM, Michael Ashmichael@gmail.com wrote: Since the last update on that page is from the Panther era, and since Leopard's IB3 completely broke backwards compatibility with IB2 plugins, I'd say the chances of the Foundation Collections Palette still working are

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Greg Guerin
Chilton Webb wrote: Is there a way to add a tag an IB object in such a way that it is not visible to the user, but in such a way that I could reference it from my app? Maybe the -tag method: it returns a 32-bit integer.. It's settable in IB as the control's tag value. I don't know if

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Chilton Webb
Hi Greg! Thanks for writing back. On Jun 18, 2009, at 4:52 PM, Greg Guerin wrote: Is there a way to add a tag an IB object in such a way that it is not visible to the user, but in such a way that I could reference it from my app? Maybe the -tag method: it returns a 32-bit integer.. It's

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Greg Guerin
Chilton Webb wrote: It *would* be useful, but IB doesn't let you set it to a string in Cocoa. It's limited to numeric values, which makes it less useful for humans. For a bit of perspective, this is doable in *CARBON* apps, via the 'Command' attribute in Interface Builder. You can only

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Ricky Sharp
On Jun 18, 2009, at 5:15 PM, Chilton Webb wrote: Hi Greg! Thanks for writing back. On Jun 18, 2009, at 4:52 PM, Greg Guerin wrote: Is there a way to add a tag an IB object in such a way that it is not visible to the user, but in such a way that I could reference it from my app? Maybe the

Re: What is the best way to store some kind of identifying string in an interface builder object?

2009-06-18 Thread Andy Lee
On Jun 18, 2009, at 4:45 PM, Michael Ash wrote: On Thu, Jun 18, 2009 at 1:59 PM, Erik Buckerik.b...@sbcglobal.net wrote: [...] You can populate the array entirely within IB. Make any target/ action connections in IB. http://www.geocities.com/kritter_cocoadev/ Since the last update on that

Re: What is the best way to copy files

2009-01-10 Thread Sean McBride
David (enki1...@gmail.com) on 2009-01-10 4:23 PM said: I'm looking for what I think are some fairly common requirements from a file copy mechanism. - simple. Why write something if you can reuse. - support multi-threading so that you can stay responsive to the UI while copying large files. - good

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-12-07 Thread Michael A. Crawford
Well, I don't know if you guys are still listening on this thread but, for the record, I did put Graham's suggestion into practice, immediately. It was fast, easy, and simple to modify when I wanted to tweak the behavior to use float values instead of integers. Thanks, Graham. After

What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Michael A. Crawford
I assume I can sub-class the control but I wondering if there is a better way. I'm using a circular slider and would like it to rotate when I roll the scroll wheel up or down. -Michael -- There are two ways of constructing a software design. One way is to make it so

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Graham Cox
On 28 Nov 2008, at 3:18 am, Michael A. Crawford wrote: I assume I can sub-class the control but I wondering if there is a better way. I'm using a circular slider and would like it to rotate when I roll the scroll wheel up or down. You can just implement the -scrollWheel: method in a

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Michael Ash
On Thu, Nov 27, 2008 at 12:08 PM, Graham Cox [EMAIL PROTECTED] wrote: On 28 Nov 2008, at 3:18 am, Michael A. Crawford wrote: I assume I can sub-class the control but I wondering if there is a better way. I'm using a circular slider and would like it to rotate when I roll the scroll wheel up

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Graham Cox
On 28 Nov 2008, at 4:08 am, Graham Cox wrote: On 28 Nov 2008, at 3:18 am, Michael A. Crawford wrote: I assume I can sub-class the control but I wondering if there is a better way. I'm using a circular slider and would like it to rotate when I roll the scroll wheel up or down. You

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Bill Bumgarner
On Nov 28, 2008, at 11:24 AM, Graham Cox wrote: Playing with this, the code below gives a nice feel for a big variety of sliders in my app and wraps properly with circular ones too. I was skeptical at first that this was a good idea but trying it out in the app I've quickly come to

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Graham Cox
On 28 Nov 2008, at 11:46 am, Bill Bumgarner wrote: Categories are great for dividing a class's implementation (sometimes across frameworks -- NSAttributedString in Foundation and AppKit, for example) and great for adding new functionality to existing classes in isolation. But they are

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Bill Bumgarner
On Nov 28, 2008, at 11:52 AM, Graham Cox wrote: In which case Apple should a) explicitly document this as a no-no, and b) disallow categories to install methods that already exist. I would have thought b) was possible, as when loading a category, I assume what's really happening is that the

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Graham Cox
On 28 Nov 2008, at 11:46 am, Bill Bumgarner wrote: At best, your app's standard sliders will behave in a decidedly non- standard fashion. At worst, your app's standard sliders will crash. Could you explain how that's a real possibility? I don't see that. If Apple's implementation of

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Graham Cox
On 28 Nov 2008, at 12:19 pm, Graham Cox wrote: Even if they couldn't remove the functionality for legacy reasons they could start documenting it in a much more strongly worded fashion to state that this is simply not permitted. Just to emphasise the point, the full paragraph you quoted

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Michael Ash
On Thu, Nov 27, 2008 at 7:24 PM, Graham Cox [EMAIL PROTECTED] wrote: Please don't do this! It will apply to every single slider in your process, even ones you didn't create yourself, Well, that is potentially a feature. I guess the point would be to test your UI thoroughly and make sure it

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Bill Bumgarner
On Nov 28, 2008, at 12:19 PM, Graham Cox wrote: On 28 Nov 2008, at 11:46 am, Bill Bumgarner wrote: At best, your app's standard sliders will behave in a decidedly non- standard fashion. At worst, your app's standard sliders will crash. Could you explain how that's a real possibility? I

Re: What is the best way to get an NSSlider to respond to the mouse scroll wheel?

2008-11-27 Thread Sherm Pendley
On Nov 27, 2008, at 7:24 PM, Graham Cox wrote: Yep, that's a potentially more serious issue. It would be nice if a category had a way to check for an existing implementation and quietly no-op itself. Just checking respondsToSelector: doesn't work of course, always returning YES. Build

Re: What is the best way?

2008-07-15 Thread Ronnie B
awakeFromNib was my first guess. Thanks for the pointers. On Mon, Jul 14, 2008 at 4:07 PM, Scott Ribe [EMAIL PROTECTED] wrote: Thats correct. The main window is not covered up. The second window is not modal I agree. In the second window I just need to collect some additional info

What is the best way?

2008-07-14 Thread Ronnie B
Hi. I am seeking an advise. I have an app that after loading a MainMenu.nib, it checks the defaults for some data and if data is not there, the app will request it via the other NIB (modal window). The Main window shall not be blocked. What would be a proper way of doing things like that?

Re: What is the best way?

2008-07-14 Thread Scott Ribe
The Main window shall not be blocked. What would be a proper way of doing things like that? What do you mean? The main window should not be covered up? Or events should still be processed by the main window? Because if it's the latter, then don't run the second window as modal. -- Scott Ribe

Re: What is the best way?

2008-07-14 Thread Ronnie B
Thats correct. The main window is not covered up. The second window is not modal I agree. In the second window I just need to collect some additional info that will go the the second's window controller. There will be OK and Cancel buttons on that window to close it. The main window will not

Re: What is the best way?

2008-07-14 Thread Shawn Erickson
On Mon, Jul 14, 2008 at 9:57 AM, Ronnie B [EMAIL PROTECTED] wrote: Thats correct. The main window is not covered up. The second window is not modal I agree. In the second window I just need to collect some additional info that will go the the second's window controller. There will be OK and

Re: What is the best way?

2008-07-14 Thread Scott Ribe
Thats correct. The main window is not covered up. The second window is not modal I agree. In the second window I just need to collect some additional info that will go the the second's window controller. There will be OK and Cancel buttons on that window to close it. The main window will

Re: What is the best way?

2008-07-14 Thread Seth Willits
On Jul 14, 2008, at 9:57 AM, Ronnie B wrote: Thats correct. The main window is not covered up. The second window is not modal I agree. In the second window I just need to collect some additional info that will go the the second's window controller. There will be OK and Cancel buttons