I'm working on a feature that will see my program automatically export to a
UTF-8 text file. This process works fine. What doesn't work fine is that
TextEdit.app (and others) does not recognise it automatically as a UTF-8 text
file, even when "Plain Text Encoding: Opening Files:" (in Preference
On 28-Jan-10, at 9:13 PM, Jerry Krinock wrote:
On 2010 Jan 28, at 16:00, K. Darcy Otto wrote:
It is my understanding that the "NSTrackingEnabledDuringMouseDrag"
is supposed to allow -mouseEntered/-mouseExited to fire during a
drag. Is this not correct?
I hope someone who
I've managed to set up a series of NSTrackingAreas. These tracking
areas work beautifully, highlighting and de-highlighting in turn by
means of -mouseEntered and -mouseExited. The problem I've run into is
that -mouseEntered and -mouseExited do not fire on a drag. Here is
the code I've us
On 28-Jan-10, at 9:38 AM, David Duncan wrote:
On Jan 28, 2010, at 9:26 AM, K. Darcy Otto wrote:
The problem is that I'm having difficulty setting up the
NSTrackingAreas. Given CA layer x, I want to discover the position
of x in the window so I can set up the tracking area. Is thi
On 28-Jan-10, at 2:47 AM, vincent habchi wrote:
Le 28 janv. 2010 à 08:43, K.Darcy Otto a écrit :
NSRect rect = NSRectFromCGRect([hitLayer frame]);
float width = rect.size.width;
That is, it returns a width, but not the width in the current
window coordinates. Any ideas? Thanks.
What do
I'm having some difficulties translating between a Core Animation
layer size, and the size of that layer in the NSView subclass I'm
using. I can identify the layer from a mouseclick without difficulty,
using the following code:
-(void)mouseDown:(NSEvent *)theEvent
{
NSPoint translated = [
I've been working with RegexkitLite, and I'm wondering whether someone
else who has RegexkitLite can reproduce this problem, or spot what I'm
doing wrong:
NSString *originalString =
@"IMUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIUUIUIUIU";
// Using the built-in "range:" option
NSStri
I just launched my first software product, and I want to thank the
many, many people on this list who helped me during the development
phase. There would be no way I could have done it without you. When I
look back at the large number of questions I have filed (all the way
from basic Objec
hat it breaks at appropriate places. There is probably some more
efficient way to check where the page should be broken, but the above
implementation works just fine.
On 13-Jul-09, at 5:16 PM, Matt Neuburg wrote:
On Mon, 13 Jul 2009 10:07:17 -0700, "K. Darcy Otto"
said:
Now, this
In an effort to get out of this problem, I also thought I might just
take a data representation of the PDFDocument object, and write the
data to a file. I get the same problem. Here is what I tried,
substituting for "[savedDoc writeToFile:@"newFile.pdf"]" below:
NSData *myData = [savedDoc
I have a PDF that I've loaded, combined with another PDF, and now I'm
ready to save the result as a new file. My program is using garbage
collection, but I understand that PDFKit is not garbage collected.
The problem is that I get reference count underflow error when writing
the PDF. Her
Thanks Matt. You were absolutely correct; the problems I have were in
-drawRect:. I'm still trying to track down a problem though, and I'm
not sure where it is. I've actually cut it down to some fairly simple
code. Here it is:
-(NSRect)rectForPage:(NSInteger)pageNumber
{
// Note
I'm working on an application which is nearing completion, but I'm
getting these strange crashes that look to be deep in the cocoa
framework. The thing is, I can't seem to diagnose these crashes, and
I can't imagine that such bugs exist in the framework such that they
pull down my applicat
I'm trying to print a custom view. I've already customized that view
in -drawRect:, and everything seems to be displayed correctly. The
problem I'm having is that when it comes time to do -rectForPage, the
output to the printer seems to shift around. Here is the code:
-(NSRect)rectForPag
I have a document-based application that has, as its main UI element,
an NSTableView subclass. I want to disable menu items based on
whether the table has a row selected. I do this via -
validateUserInterfaceItem, and everything works under normal
circumstances: I check for a selected row
I have an NSTableView subclass that has a pair of columns that are
acting inconsistently when the user double-clicks to begin editing.
In the first column, the user can double-click anywhere in the cell to
begin editing that cell. In the second column, which is the last
column of the tabl
Okay, I have got Apple Help working for my application (the first time
I have written a help book), and I wanted to encapsulate some of what
I have learned in a message, in case others might benefit. The docs
about how to set up help are good, but still (for me) left some
questions unanswe
Thanks to those who helped me with this question. The solution was to
use NSWindow's -attachedSheet method, and (in my case), check for
nil. If nil, there is no attached sheet; if not nil, there is an
attached sheet.
___
Cocoa-dev mailing list (
I want to thank Fritz, Greg, Quincy and Uli for their help solving
this problem. I don't think there is any general solution to this
problem, but I wanted to make two remarks that might help others who
run into something similar.
(i) It turned out that i did have two different MyDocument o
problem, the more I
became perplexed about self referring to two different objects. I"m
wondering what is actually going on (independently of whether I get
the sheet working). It seems like the sort of thing that might cause
other problems.
D
On 9-Jun-09, at 10:12 AM, Greg Guer
dowDidEndSheet:
self at validateUserInterfaceItem:
Bizarreness at **! I mean, -init is only run once!
(I'll answer your question in the next message; I know there is a
limit to message lengths on the list, so I'll break it up.) Thanks
again.
On 9-Jun-09, at 10:12 AM, Gr
into
the -init of MyDocument; it seems like it is only being called once.
Is there some other way to create the object (there are no other init-
type routines in the class)?
On 8-Jun-09, at 10:55 PM, Fritz Anderson wrote:
On 8 Jun 2009, at 10:02 PM, K. Darcy Otto wrote:
The sheet opens
Well, the sheet has to do some pretty complicated things, so I gave it
its own NSWindowController subclass (PanController). The sheet's
window controller is created by my NSDocument subclass (MyDocument).
The thing is though, PanController is not a subclass of NSDocument, so
it's strange
I'm having some problems pinning down what is going on when I open a
panel: object variables seem to get reset somehow, and "self" seems to
change. Here is some code, from my NSDocument subclass (MyDocument):
-(void)windowWillBeginSheet:(NSNotification *)notification
{
sheetOpen = YE
pen.
On Jun 8, 2009, at 2:08 PM, K. Darcy Otto wrote:
In my -validateUserInterfaceItem: method, I need to know whether a
particular panel is open (and this panel comes down as a sheet in
front of the main window). How can I determine whether that panel
has come down as a sheet?
>
In my -validateUserInterfaceItem: method, I need to know whether a
particular panel is open (and this panel comes down as a sheet in
front of the main window). How can I determine whether that panel has
come down as a sheet? I have tried the following:
(1) Setting a flag in -windowWillBeg
An update on this question. It turns out the first bit of code does
not work after all, because 48 is the keyCode for [Tab] and [Shift
+Tab]. I needed to change the code to the following:
-(void)keyDown:(NSEvent *)theEvent
{
if ([theEvent keyCode] == 48 && ([theEvent modifierFlags] &
NSSh
Following a hint from Matt Neuburg, I managed to solve this problem by
deleting ~/Library/Caches/com.apple.helpui.
Incidentally, deleting this file also seems to help when I have
another problem. If I delete and regenerate the help book HTML, the
old help book is still displayed by the pro
I have an application where a 2-column NSTableView subclass is the
main visual element. Users can select rows only, not columns. When
the user has a row selected, and presses [Tab], the table
automatically starts editing the first column. I want to make it so
that when the user has a row
I have created a Help Book that is indexed and recognised as part of
the Help function, running under Leopard. The Spotlight search works
fine (when the user types search terms directly into the help menu).
However, when the Help application has started, and the user types a
search term i
the first character of the field. I
suppose to be safe, you might specify the font directly:
[fieldEd setFont:[NSFont fontWithDescriptor:
size:]];
On 18-May-09, at 2:46 PM, K. Darcy Otto wrote:
I need to trap-and-replace various keypresses in the field editor.
I do this with -controlTex
I need to trap-and-replace various keypresses in the field editor. I
do this with -controlTextDidChange: in my delegate. So, when the user
presses ">", I replace it with a "superset of" (⊃) character (in case
this does not come out on the list, I'm going to represent the
"superset of" cha
subclass. Thanks,
Darcy
On 17-May-09, at 6:38 AM, Jim Correia wrote:
On Sat, May 16, 2009 at 9:05 PM, K. Darcy Otto
wrote:
I have an NSTextFieldCell subclass that needs to draw itself
differently
depending on which NSTableView row it is drawing. My current
solution is to
store the row that
, at 6:38 AM, Jim Correia wrote:
On Sat, May 16, 2009 at 9:05 PM, K. Darcy Otto
wrote:
I have an NSTextFieldCell subclass that needs to draw itself
differently
depending on which NSTableView row it is drawing. My current
solution is to
store the row that is being drawn in my document class
I have an NSTextFieldCell subclass that needs to draw itself
differently depending on which NSTableView row it is drawing. My
current solution is to store the row that is being drawn in my
document class in an instance variable (the assignment is done in -
tableView:willDisplayCell:forTable
is getting drawn?
Seems a bit kludgy.
Thanks for your help.
On 30-Apr-09, at 8:49 PM, Jim Correia wrote:
On Thu, Apr 30, 2009 at 11:38 PM, K. Darcy Otto
wrote:
Option 2: Moving the text displayed by the NSTableView to the right
by some
way other than inserting spaces. This might be
I have an NSTableView subclass that adds a few spaces to data from the
source when it is displayed. So:
Datasource for cell: "A" (1)
NSTableView displays: " A" (2)
Now, when the field editor is called, it edits (2), not (1). Fair
enough. But I need to edit (1). So, how do I do this? I
return the desired rect,
in a new position.
On 29-Apr-09, at 9:58 PM, K. Darcy Otto wrote:
So, I have continued my work with a subclass of NSTextView for my
field editor, and here is another part of the puzzle: (i) if I
implement -drawRect: in the subclass, and ask it for the frame, the
frame
that box, and is there a way to
move it?
On 28-Apr-09, at 12:47 PM, K. Darcy Otto wrote:
Continuing on with the mystery, I have tried the following code in
my NSTableView subclass (below, not yet solved though). I have got
it so that the rect returned by [fieldEditor frame] is not empty
Hi Ulai,
Did you find a solution to this problem? I'm trying to do the same
thing.
Darcy
Hi,
Let's say I want to have the field editor for a table view appear 2
pixel below where it usually is, i.e. shifted 2 pixels down.
How can I do this?
Consider the following hypothetical situatio
Thank you for the suggestions. It turns out that I went the second
way, and it works just fine (to tell you the truth, I was a bit
apprehensive at getting into drawing, but it wasn't as difficult as I
had suspected - the -frameOfCellAtColumn:row: really made everything
not too bad at all).
cellRect = [fieldEditor frame];
NSLog(@"2. fieldEditor x origin: %f",cellRect.origin.x); // output: 147
}
On 27-Apr-09, at 7:19 PM, K. Darcy Otto wrote:
I have a field editor which I need to reposition in my tableView –
specifically, I need to move it a few pixels to the r
I have a field editor which I need to reposition in my tableView –
specifically, I need to move it a few pixels to the right. The
following post:
http://www.cocoabuilder.com/archive/message/cocoa/2009/3/16/232513
makes two suggestions: (i) implement the move in -viewWillDraw in the
field
I'm attempting to model a real-world table structure with an
NSTableView. Here is what the table structure might look like on
paper (warning: ASCII art ahead):
1. | A
2. || B
3. |||C
4. D
5. E
6. F
Between the number and the letters are a series of (unbroke
I have a number of NSTextFields that are happily bound to NSString
objects in the controller, and they work very well: if the textfield
is updated, the corresponding NSString object is updated, as vice-
versa. Now, in order to implement drag-and-drop, I have had to
subclass NSTextField and
/ Set the keyPath of boundObject to draggedFormulaString
[boundObject setValue:draggedFormulaString forKeyPath:keyPath];
On 17-Apr-09, at 7:50 PM, K. Darcy Otto wrote:
I have a number of NSTextFields that are happily bound to NSString
objects in the controller, and they work very well:
Yes, I was thinking this too, at first. But then I started to look
around to see if I could find analogous situations. The closest I can
come is when Pages has a table - let's say 2x2. When the user is in
the bottom right cell, and presses tab, two things happen
simultaneously: the data
I am writing a program which has a two-column table. The user can
fill in the table with whatever he or she wishes, but sometimes it is
possible to determine what should be displayed in the left column by
looking at what is displayed in the right column. I have set up the
program so that
I am writing a document-based application, and seem to be having a
problem with my NSDocument object (using the standard MyDocument.h/m)
changing. In particular, I have a toolbar button that brings up a
previously populated NSWindowController and shows a window and a
panel). The problem a
I have a preferences window with an NSSlider control in it that has to
update continuously in order to indicate just where the marker is on
the scale. But, because of the relatively complex changes required
when the slider is set, I only want to act on the slider settings when
the slider h
Thanks Corbin and Paul. I am using the
windowWillReturnFieldEditor:toObject: delegate method, testing to see
if anObject is a DeductionTable (a subclass of NSTextView), and
testing to see if the first responder is an NSTextView, and then
changing the textColor of the first responder to bla
Thanks for this. I think this would solve part of the problem (when
it was clicked on by the user), but not if the text edit field were
selected in some way other than a mouse click. But you gave me an
idea: what about subclassing NSTextView, so that when the field editor
is called, the c
Well, I've tried just about everything I can think of at this point,
but can't change the NSTableView cell successfully. To give some more
detail, the cell text is red when there is an error, but when the user
goes to edit the cell, I want to change the cell text back to black.
I can chang
I want to change the contents of an NSTableView cell immediately prior
to editing, but cannot figure out how to do this. That is, I want to
return YES to tableView:aTableView:shouldEditTableColumn:row:, to
permit editing to begin, but before editing actually begins, modify
the colour and t
I have a window in which I'm swapping views. The mechanism by which
the user indicates the view should be swapped is a series of four
radio buttons (so, it is sort of like having a tab view, except
instead of tabs up the top, there are radio buttons in the view
itself). The radio buttons
+= deltaWidth;
[box setContentView:nil];
[w setFrame:windowFrame display:YES animate:YES];
[box setContentView:v];
}
On 21-Feb-09, at 11:58 AM, Markus Spoettl wrote:
On Feb 21, 2009, at 8:03 PM, K. Darcy Otto wrote:
I had considered doing this with Core Animation
GPU-powered and more importantly won't block the
main thread during the animation (I frequently try to move the
System Prefs somewhere more convenient while a pane is loading, and
it annoyingly snaps back into place).
Mike.
On 21 Feb 2009, at 02:31, K. Darcy Otto wrote:
I have a windo
Some additional information that I just discovered: when the window is
textured, it does not flicker at all, but if not textured, it flickers
noticeably.
On 20-Feb-09, at 6:31 PM, K. Darcy Otto wrote:
I have a window, and get that window to resize according to the
various custom views I
I have a window, and get that window to resize according to the
various custom views I plop in the window. My purpose here is to
(somewhat) emulate the system preferences window that grows and
shrinks as necessary. The resizing works fine, but when I want to
animate the resizing, there is
On 10-Dec-08, at 8:54 PM, Graham Cox wrote:
On 11 Dec 2008, at 2:53 pm, K. Darcy Otto wrote:
I'm trying to get undo working with an application that is not
document-based. So far, I think I have got the operation on the
stack, but have yet to get the menu reflecting this. What I
I'm trying to get undo working with an application that is not
document-based. So far, I think I have got the operation on the
stack, but have yet to get the menu reflecting this. What I have so
far is the initialisation of undoMan (in init:), but when I get the
operation onto the stack (
he whole protocol in a
private undistributed header.
On Apr 28, 2008, at 9:22 PM, K. Darcy Otto wrote:
Okay, I have done this, and things are compiling and running
correctly. Thank you. Two additional questions then. First, I
still get the warning that the superclass "may not respon
B : ClassA
{
...
}
...
@end
This will stop compiler warnings and will also warn if a class you
defined to use the protocol doesn't have an implementation for the
method(s) in that protocol.
On Apr 28, 2008, at 6:00 PM, K. Darcy Otto wrote:
I need to have a subclass optionally extend a method
I need to have a subclass optionally extend a method already in the
superclass. After some research, my best guess is that an optionally
defined protocol is the best way to go about this. So, what I have in
the superclass is:
@interface ClassA : NSObject
{
...
}
...
@end
@protocol Check
I am working on a program with a complex hierarchy of classes, and I
want to subclass one of the objects a few steps down on that
hierarchy. Do I have to create a parallel hierarchy to do this? Here
is the problem:
AppController instantiates a Deduction object.
The Deduction object instan
My code used to look like this:
NSMutableArray *newDependencies = [self.dependencies mutableCopy];
[newDependencies addObjectsFromArray:[aDependency dependencies]];
Now self.dependencies and [aDependency dependencies] both return
NSArrays. The code works very well provided th
On 11-Apr-08, at 1:07 PM, Corbin Dunn wrote:
On Apr 11, 2008, at 11:38 AM, K. Darcy Otto wrote:
The application I am working on is essentially one big table, and
I'd like to restore at least one aspect the default tab behaviour
that Tiger used when editing tables. Namely, when the us
The application I am working on is essentially one big table, and I'd
like to restore at least one aspect the default tab behaviour that
Tiger used when editing tables. Namely, when the user is at the end
of the row and hits tab, I'd like editing to begin at the beginning of
the next row.
See the following for the solution:
http://www.cocoabuilder.com/archive/message/cocoa/2008/4/4/203185
On 31-Mar-08, at 5:18 PM, K. Darcy Otto wrote:
Closing in on a solution (but not quite there):
I have made some progress in solving this problem, but still have
one strangeness (detailed
Thank you very much; this is exactly the solution. Just for others
who might have this problem, here is how i solved it:
1. Set up a NSText variable globally: NSText *fieldEd
2. Implement controlTextDidBeginEditing: as below:
-(void)controlTextDidBeginEditing:(NSNotification *)notification
{
I need to intercept changes in my NSTableView's field editor, and I am
able to do this successfully implementing controlTextDidChange: in my
controller. I do this by having my controller create a field editor
(fieldEd, an NSTextView) and setting the delegate of that field editor
to my cont
it is
automatically replaced by "→". The problem I'm having is that
hitting return or tab no longer ends editing of the current cell. I
have tried implementing doCommandBySelector: to take care of this, but
as soon as I do, I lose return, tab and the arrow keys. Any ideas?
On 31
On Mar 31, 2008, at 00:29, Quincey Morris wrote:
> On Mar 30, 2008, at 23:08, K. Darcy Otto wrote:
>
>> I'm working on an application in which users enter data into a
>> table, but I need to substitute a greater-than symbol (>) for a
>> right-arrow symbol (→, un
I'm working on an application in which users enter data into a table,
but I need to substitute a greater-than symbol (>) for a right-arrow
symbol (→, unicode: 2192) as the user presses they key (or copies the
text, or whatever). After looking at the docs and this list, I'm not
much closer
I've been trying to add some human-readable error codes to my classes
using enum, but have been running into some difficulties when I add a
different enum of the same name to a different class. Here is what I
have so far in my DeductionLine class (and I think it will suffice
just to show t
it confused, since the class name begins
with a capital, and the method begins with a miniscule? Thanks again.
On 20-Mar-08, at 4:16 PM, Quincey Morris wrote:
On Mar 20, 2008, at 15:25, K. Darcy Otto wrote:
So, I seem to be having a problem with the following code, and I
think I've
So, I seem to be having a problem with the following code, and I think
I've traced it to how the messages are nested; but I cannot seem to
solve it. Consider the following code, which works without warnings
(self.sequent is an NSArray):
DeductionLine *dl1 = [self.sequent objectAtIn
I'm trying to create an initializer that allows me to combine
initialization and some setting of variables, but I get an error that
an "unrecognized selector" has been sent to the object. Here is what I
have so far:
Fraction.h:
#import
@interface Fraction : NSObject {
NSInteger n
78 matches
Mail list logo