Re: -outlineView:heightOfRowByItem: gets an item of NULL??

2008-02-22 Thread John Stiles
0x95b4b0f9 in -[NSApplication run] #380x95b1830a in NSApplicationMain #390x7f72 in main at EditorMain.mm:62 Corbin Dunn wrote: Yes to everything, thanks! corbin On Feb 22, 2008, at 12:15 PM, John Stiles wrote: OK, that makes sense. My -outlineView:numberOfChildrenOfItem: doesn't

Re: Layout manager's -rectArrayForCharacterRange:::: returns zero rectangles??

2008-02-25 Thread John Stiles
I managed to reproduce this in a small test app so it's filed as: rdar://5764057 NSLayoutManager cannot get bounding rect of glyph when deleting at end of text For now I will use -performSelector:inMainThread:afterDelay: to kludge around it. It's better than nothing. John Stiles

Re: NSBorderlessWindowMask and NSResizableWindowMask

2008-02-25 Thread John Stiles
Borderless windows don't support all the things that normal windows do; the resize widget is one example. Sorry. Why would you want this exactly? It doesn't seem like a typical thing to do… Eric Morzier wrote: Hi, I've tried to create a NSBorderlessWindowMask with the resize indicator (the

Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item

2008-02-26 Thread John Stiles
. Ideally the text wouldn't turn white if the user's chosen selection color was sufficiently light. There's scope for making that work in the backgroundStyle API. -Ken On Mon, Feb 25, 2008 at 5:12 PM, John Stiles [EMAIL PROTECTED] wrote: In my outline view, I'm using an NSTextFieldCell

Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item

2008-02-26 Thread John Stiles
setTextColor, you could override -drawInteriorWithFrame:inView:. -Ken On Tue, Feb 26, 2008 at 11:35 AM, John Stiles [EMAIL PROTECTED] wrote: Actually, for what it's worth, I did just hit one snag. If you attempt to edit the cell, the field editor inherits the white color! This makes it pretty

Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item

2008-02-26 Thread John Stiles
you out of NSCell's built-in processing, so you'd at least want to limit it to older OSes, and may have other bad aspects to it. I'm not really advocating this path, this is more or less just an FYI as to how the framework works. -Ken On Tue, Feb 26, 2008 at 1:26 PM, John Stiles [EMAIL PROTECTED

Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item

2008-02-27 Thread John Stiles
Right, agreed. Ken's idea was that I would implement my own -drawInteriorWithFrame:inView:, which is what I was saying I didn't want to do. Seth Willits wrote: On Feb 26, 2008, at 3:13 PM, John Stiles wrote: Trying to simulate the drawing behavior of NSCell seems error-prone to me. Since I

Re: Draging multimple NSWindows simultaneously

2008-02-27 Thread John Stiles
You don't need delegates for this. Look into child windows. Jorge Luis Chavez Herrera wrote: Hello everyone! I'm trying to figure out a way to make an NSPanel to follow a NSWindow while it is being dragged. The two notifications sent to an NSWindow delegate are only good for knowing if the

Re: Combining NSLineBreakByWordWrapping + NSLineBreakByTruncatingTail in NSTextView

2008-02-28 Thread John Stiles
I don't know the answer, but if you figure it out, please post a followup on Cocoa-Dev. I could use this also :) Mattias Arrelid wrote: Hi there. Occasionally I need to display some very long strings. These string can have sentences that would span several lines depending on the width of my

Re: [NSOutlineView] How to know an item is expanded if its parent item is not?

2008-03-01 Thread John Stiles
Unless Stephane plans on manually tracking the expanded items himself, I don't see how this answers his original question—and I think it's a valid question, too. j o a r wrote: On Mar 2, 2008, at 12:02 AM, Stéphane Sudre wrote: An I missing something and is there a way to know which items

Re: Relaunching an application

2008-03-03 Thread John Stiles
Mattias Arrelid wrote: On 3 mar 2008, at 18.14, Nir Soffer wrote: On Mar 3, 2008, at 18:24, Mattias Arrelid wrote: I have an application that I need to restart. Why do you want to do that? A scenario could be that the entire contents of the .app bundle has been replaced with new stuff

Re: How to get an NSString from a non-terminated array of unicode chars (length is known)

2008-03-04 Thread John Stiles
Brady Duga wrote: On Mar 4, 2008, at 8:25 AM, Dave Camp wrote: You actually have two problems here: 1) wchar_t on the Mac is a 4 byte per character container (32 bits). Not quite correct. wchar_t, may, at this time, default to 4 bytes in an Xcode project, but it is *not* defined to be 4

Re: How to get an NSString from a non-terminated array of unicode chars (length is known)

2008-03-04 Thread John Stiles
. It's been a few years since the last time I had to deal with 16-bit wchar_ts. At the time I remember needing to borrow large chunks of MSL from CodeWarrior, and getting it to compile on Xcode… bleck. Brady Duga wrote: On Mar 4, 2008, at 10:13 AM, John Stiles wrote: However, don't expect

Deferring a selector until later, but before painting

2008-03-05 Thread John Stiles
There are many times in my code where I want to defer a selector's execution until the next time the event loop runs, which is a perfect match for -performSelector:withObject:afterDelay:, passing a delay of 0.0. However, this executes after the app has repainted all the windows. Is there a way

Re: Deferring a selector until later, but before painting

2008-03-06 Thread John Stiles
Oh, wait… this requires Leopard :| Is there anything that works with Tiger? I'm trying to avoid Leopard dependencies when there are easy substitutes. John Stiles wrote: Actually, in this case, it seems like a perfect fit for what I'm doing. I'm already using a subclassed view anyway. I

Re: Deferring a selector until later, but before painting

2008-03-06 Thread John Stiles
On Leopard, this solution works perfectly. I get a chance to update my view right before it draws, which is exactly what the doctor ordered. Any way to get this on Tiger or am I just out of luck? John Stiles wrote: Oh, wait… this requires Leopard :| Is there anything that works with Tiger

Re: Deferring a selector until later, but before painting

2008-03-06 Thread John Stiles
Ken Ferry wrote: On Thu, Mar 6, 2008 at 2:06 PM, John Stiles [EMAIL PROTECTED] wrote: Ken Ferry wrote: On Thu, Mar 6, 2008 at 9:59 AM, John Stiles [EMAIL PROTECTED] wrote: On Leopard, this solution works perfectly. I get a chance to update my view right before it draws, which

Re: GetMonitorFromWindow

2008-03-07 Thread John Stiles
knows? (I've only just realised I'm quoting a Blizzard guy!) -- Daniel On 7 Mar 2008, at 16:38, John Stiles wrote: I'm going to jump on the bandwagon and say that your client is wrong. Mac apps do not and should not do this. ___ Cocoa-dev mailing list

Re: GetMonitorFromWindow

2008-03-07 Thread John Stiles
Well all right then, the OP should check out the NSWindow delegate methods, and NSScreen. :) Randall Meadows wrote: On Mar 7, 2008, at 9:38 AM, John Stiles wrote: I'm going to jump on the bandwagon and say that your client is wrong. Mac apps do not and should not do this. Sorry, I've got

Re: How to get the name of a method at runtime?

2008-03-10 Thread John Stiles
My experience with dladdr has been that it returns junk at least half of the time. IIRC, Tiger was worse than Leopard, but neither is as accurate as NSTask'ing out to atos (which basically works perfectly, albeit slow as dirt). I've got an open radar on it. stephen joseph butler wrote: On

Re: fileExistsAtPath with * to indicate random

2008-03-10 Thread John Stiles
You could use -directoryContentsAtPath: and check the array yourself for matches. Mr. Gecko wrote: Hello, I'm new to cocoa so any help will be appreciated. I'm needing my application to find out if ImageMagick is installed. It is usually installed in the root directory(/) and it has the

Re: fileExistsAtPath with * to indicate random

2008-03-10 Thread John Stiles
In general this is excellent advice, but I believe ImageMagick is not a Mac program but an X11 thing. Brian Stern wrote: On Mar 10, 2008, at 12:10 PM, Mr. Gecko wrote: I'm needing my application to find out if ImageMagick is installed. You should look at Launch Services. This Carbon API

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
, at 3:27 PM, John Stiles wrote: Interface Builder can easily make a small variant of NSSearchField—it's right there in the size popup—but I can't manage to reproduce the effect in code. The typical approach doesn't work: [[searchField cell] setControlSize:NSSmallControlSize]; does nothing

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
, cellSizeForBounds: doesn't give you the size you want. -Tom On Mar 10, 2008, at 3:45 PM, John Stiles wrote: I've done all of these things, and so far no dice. The small control clearly has a different overall look—for instance, the magnifying glass icon has a smaller variant which I do not see. Also, when

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
= cellSize.height; [searchField setFrame:searchFrame]; If you don't set the font first, cellSizeForBounds: doesn't give you the size you want. -Tom On Mar 10, 2008, at 3:45 PM, John Stiles wrote: I've done all of these things, and so far no dice. The small control clearly has a different overall look

Re: Small variant of NSSearchField?

2008-03-10 Thread John Stiles
BTW, this is now filed as rdar://5791056 [NSSearchFieldCell] Does not properly honor calls to -setControlSize: Thanks again for everyone's help debugging this issue! John Stiles wrote: OK, I figured it out. My control's frame was too tall! If you set the search field's frame

Controlling line tightening

2008-03-11 Thread John Stiles
I'm using line tightening in some of my dialogs and 99% of the time it works great, but there are a few aspects of it that don't work for my app. In particular, when line tightening kicks in, first it attempts to shrink the text to fit the box, which is awesome. But when it still doesn't fit

Re: Controlling line tightening

2008-03-11 Thread John Stiles
for my needs. The ellipsis was the big problem. John Stiles wrote: I'm using line tightening in some of my dialogs and 99% of the time it works great, but there are a few aspects of it that don't work for my app. In particular, when line tightening kicks in, first it attempts to shrink the text

Re: Cocoa-dev Digest, Vol 5, Issue 393

2008-03-12 Thread John Stiles
Daniel Child wrote: Each record is allocated and explicitly released at the end of the loop after adding it to the table. I thought autorelease might wait too long to get rid of it, so I do it explicitly. Just because you never autorelease it in your code, doesn't mean that it is never

Re: Controlling line tightening

2008-03-12 Thread John Stiles
Followup: this requires a bit of math but it works great in practice. I have a lot more control over the tightening now, which is just what I needed. Thanks! John Stiles wrote: Interesting! I didn't think to use kerning directly. Thank you for the idea!! It makes sense since obviously I am

Re: Controlling line tightening

2008-03-12 Thread John Stiles
/NSParagraphStyle_Class/Reference/Reference.html#//apple_ref/occ/instm/NSParagraphStyle/tighteningFactorForTruncation Aki On 2008/03/12, at 11:35, John Stiles wrote: Followup: this requires a bit of math but it works great in practice. I have a lot more control over the tightening now, which is just what

Re: runtime error

2008-03-12 Thread John Stiles
for me.) On Mar 12, 2008, at 1:47 PM, John Stiles wrote: Daniel Child wrote: Each record is allocated and explicitly released at the end of the loop after adding it to the table. I thought autorelease might wait too long to get rid of it, so I do it explicitly. Just because you never

Re: performSelectorOnMainThread problem

2008-03-12 Thread John Stiles
If -updateProgress is taking data as an argument, then you probably want @selector(updateProgress:) Note the colon. Nick Rogers wrote: Hi, In my secondary thread I'm doing: [self performSelectorOnMainThread:@selector(updateProgress) withObject:data waitUntilDone:YES]; with the error that

Re: Best Way To Lookup From a Huge Table

2008-03-13 Thread John Stiles
NSDictionary should be all you need here. It internally uses a hash table to find keys, so it should be extremely fast. Karan Lyons wrote: What's the best way to lookup something from a huge table? I'm trying to write a piece of code that checks weather data given a zipcode. But I

Re: [Q] How can I repair file name with wrong encoding?

2008-03-13 Thread John Stiles
Maybe it's treating the filename bytes as Latin-1? Just a guess, but that'd be the first thing I'd check. Second would be MacRoman. Aki Inoue wrote: Yes, sounds like there really is a bug. Please file a bug and attached the zip archive possible. Thank you, Aki On 2008/03/13, at 7:48,

Re: Best Way To Lookup From a Huge Table

2008-03-16 Thread John Stiles
Well, at the risk of sounding silly, you call insert 41,000 times. Were you expecting a more exciting answer? :) Paul Thomas wrote: On 15 Mar 2008, at 02:35, Scott Ribe wrote: Of course, for me, the simplest way would probably be std::map int, string , but that's just my personal taste.

Re: Equivalent to Carbon's TransitionWindow(); using genie when opening an NSWindow

2008-03-18 Thread John Stiles
TransitionWindow was never implemented well in OS X, as far as I know. Last I checked, it simply drew a few zoomrects using the look of the old OS 9 Finder. Not too impressive. It didn't do genie effects either. You might look into NSWindow's - (void)setFrame:(NSRect)windowFrame

Re: Adding spaces to an NSString

2008-03-18 Thread John Stiles
making it work and optimizing later.. Jason On 3/18/08 5:46 PM, John Stiles [EMAIL PROTECTED] wrote: Have you looked at NSMutableString? The APIs are pretty basic here. I'd recommend working from right-to-left; you'll find it probably makes the logic simpler. J. Todd Slack wrote: Hello

Re: Using C++ classes from Objective C

2008-03-19 Thread John Stiles
Are you #including the header which declares MyClass? Jeremy wrote: Hi. I am just starting to learn Cocoa and would like to use standard C++ classes from my Objective C/C++ classes. Is there any known documentation on how to do this, or does anyone have any pointers? I tried creating a

Re: Using C++ classes from Objective C

2008-03-20 Thread John Stiles
Without starting a religious war, I have to disagree with this. ObjC++ is probably a bad idea if you are a novice programmer in general, but I think it also has some really good things going for it, and having written huge amounts of ObjC++ code, I think it's perfectly straightforward to use.

Re: doubleValue (for an NSString)

2008-03-20 Thread John Stiles
You could always do this float value; if (1 == sscanf([myString UTF8String], %f, value)) { // the string was a valid float } else { // it wasn't } For integer, replace float with int and %f with %d. Localization concerns still apply in theory but in practice there are few locales which

Re: Best Way To Lookup From a Huge Table

2008-03-21 Thread John Stiles
Michael Ash wrote: On Thu, Mar 20, 2008 at 7:58 PM, E. Wing [EMAIL PROTECTED] wrote: You really should profile to find your bottlenecks, especially when the STL is concerned. My personal experience has been that gcc poorly optimizes STL code automatically for you and you must go in and

Re: Best Way To Lookup From a Huge Table

2008-03-21 Thread John Stiles
Michael Ash wrote: On Fri, Mar 21, 2008 at 12:13 PM, John Stiles [EMAIL PROTECTED] wrote: Michael Ash wrote: For what it's worth, I wrote a quick test program creating 50,000 random key/value pairs of NSStrings of around 500 characters each, then inserted them into an NSDictionary. My

Re: Best Way To Lookup From a Huge Table

2008-03-21 Thread John Stiles
the underlying guts were actually doing a more sophisticated task (copy instead of reference, sorted instead of unsorted). Other than that, you've been giving credit pretty much where it's due. Michael Ash wrote: On Fri, Mar 21, 2008 at 4:51 PM, John Stiles [EMAIL PROTECTED] wrote: It's fine that you

Re: dealloc methods not being called?

2008-03-21 Thread John Stiles
AppKit does an optimization where at app shutdown time, it stops dealloc'ing things. It does make app quitting faster, but it means that if your deallocs have side effects, the side effects will never occur. It also makes leak tracking difficult if you try to do a full-on leak check at

Re: NSImage trapezium...

2008-03-23 Thread John Stiles
FWIW, if you find yourself needing to do much more in the way of distorting images, I'd recommend looking into OpenGL directly. It's extremely fast since it goes straight to the hardware, and doing something like map an image to a trapezoid is /very/ few lines of code. Much simpler than trying

Subverting the first responder chain

2008-03-27 Thread John Stiles
I am implementing a custom NSView subclass (actually a simple subclass of NSOpenGLView) that implements -keyDown: in order to respond to user typing. Typically, this works great. However, I have a few menu items which respond to atypical hotkeys (e.g. one responds to space, another to

Re: Subverting the first responder chain

2008-03-27 Thread John Stiles
before handling -keyDown:, maybe I'll just keep doing that. It's gross but I guess all the potential solutions are gross. Ken Thomases wrote: On Mar 27, 2008, at 7:52 PM, John Stiles wrote: I am implementing a custom NSView subclass (actually a simple subclass of NSOpenGLView

Re: Subverting the first responder chain

2008-03-31 Thread John Stiles
that the message to super didn't work precisely because the next responder in my main application was accidentally swallowing all keyDowns. I apologize for the misinformation, but thank you for helping me find a bug. Allen -Original Message- From: John Stiles [mailto:[EMAIL PROTECTED] Sent: Fri

Re: test if another app has hung

2008-04-01 Thread John Stiles
I have a vague recollection that the mechanism used by Activity Monitor and friends is not public API, unfortunately. Martin Redington wrote: I went to check the referenced thread, as this is something I wanted to do occasionally, when I noticed that I was the OP for it. The discussion

Re: [NSPipe pipe] returning nil (running out of filehandles?)

2008-04-01 Thread John Stiles
I haven't experimented with CC_MD5, but we do have code which calculates MD5s (calculated via simple C code). Is CC_MD5 optimized e.g. using SSE or AltiVec? Should I expect to see a perf boost if I swapped in this code instead of our regular C code? Jean-Daniel Dupas wrote: Le 2 avr. 08 à

Re: [NSPipe pipe] returning nil (running out of filehandles?)

2008-04-02 Thread John Stiles
Jens Alfke wrote: Also, you're aware that MD5 shouldn't be used for anything security-related anymore? Last I heard it's pretty close to being fully broken. SHA-1 is a lot more secure, and has a larger output which itself makes collisions less likely. Fully broken? I don't know about

Re: Name of NSTableView

2008-04-02 Thread John Stiles
Your delegate and data source can be the same object if you want. Nothing prevents it. Mr. Gecko wrote: What do you mean by the name? in the identity tab of Interface builder You could make one class that has all of the common code, and then subclass it for each table instance. That's a

Re: Objective-C Instance Variable Names

2008-04-03 Thread John Stiles
I'd never heard the Smalltalk conventions before, but I have to admit I really like the sound of them. I'd love to see a block of code written to these rules to see how it plays out in practice. (ObjC or C++, that is, not Smalltalk.) Robert Claeson wrote: On 3 Apr 2008, at 19:58, Rob

Re: how to hack my own apps

2008-04-03 Thread John Stiles
I'm not a hacker, but if I had to figure out how a Cocoa app worked in a hurry, I'd check out F-Script Anywhere. justin webster wrote: just wondering how easy it is for would-be hackers to get inside my code. how meaningful and human-readable is a reverse engineered version of my app? is

Re: Objective-C Instance Variable Names

2008-04-06 Thread John Stiles
You can't be KVC compliant if you use prefixes like m_, so this limits your potential for using things like bindings. When I write C++, I am also a fan of m_, but it's just not appropriate for Cocoa since it basically means you're fighting against the frameworks. Scott Andrew wrote: See i

Re: Obj-C idioms for list based tasks

2008-04-07 Thread John Stiles
Cocoa doesn't have ordered sets. It has arrays (NSArray), unordered sets (NSSet), and unordered key-value tables (NSDictionary). Any of these can optionally be mutable. NSCountedSet also allows for the equivalent of a multiset, but for some reason there is no NSCountedDictionary, for the

Open-source NSToolbar?

2008-04-07 Thread John Stiles
I'm looking for an open-source NSToolbar-like toolbar implementation... do any exist? I haven't found any yet. I want to check it out and see how some things are done... I don't really need a ton of features outside the standard toolbar stuff, it's more for learning/research to see what can

Apparent bug with button hotkeys that use shift

2008-04-07 Thread John Stiles
I am trying to add some hotkeys to buttons in my app, and I've hit a weird snag. Specifically, the shift modifier flag appears to be ignored for anything other than alphanumeric keys—i.e. I can't make a button that corresponds to cmd+F1 and a second button that corresponds to cmd+shift+F1.

Re: Apparent bug with button hotkeys that use shift

2008-04-07 Thread John Stiles
For any curious Apple engineers, I've just filed this issue as rdar://5848023 and attached a test app (four lines of code). John Stiles wrote: I am trying to add some hotkeys to buttons in my app, and I've hit a weird snag. Specifically, the shift modifier flag appears to be ignored

Re: Open-source NSToolbar?

2008-04-08 Thread John Stiles
Well, I was thinking more along the lines of an RBSplitView, something you can just drop into your nib/code and suddenly your toolbars are better :) Thanks for the pointers, everyone. [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote on 2008-04-07 17:47:30: I'm looking for an open-source

Re: Open-source NSToolbar?

2008-04-09 Thread John Stiles
This is very cool and I would have used it if I had known about it earlier, but it isn't a replacement for NSToolbar so much as a simpler way to create one (which is awesome and should have been there all along). Geoff Beier wrote: On Tue, Apr 8, 2008 at 12:25 PM, John Stiles [EMAIL

RE: Hide application from dock

2008-04-09 Thread John Stiles
You cannot tell your app to hide from the dock once it has shown. However, you can start hidden and become visible via the (IIRC) TransformProcessType API. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jere Gmail Sent: Wednesday, April 09, 2008 2:11 PM

Re: Hide application from dock

2008-04-09 Thread John Stiles
Even if you could change it, once your app is running it, changing the plist won't have any effect until the next time the app is run. So it's probably a moot point. glenn andreas wrote: On Apr 9, 2008, at 4:41 PM, Randall Meadows wrote: [resending with my subscribed address--grrr] On Apr

Re: NSTableView memory usage

2008-04-14 Thread John Stiles
I think Instruments could do a better job of telling you what's going wrong than we could. FWIW, the table view doesn't even know the contents of most of your 1500 rows. It asks for them from the data source as it needs them, and probably only knows the values of the currently visible cells.

Re: how should I go about downloading files

2008-04-14 Thread John Stiles
Laimonas Simutis wrote: On Fri, Apr 11, 2008 at 6:01 PM, Scott Anguish [EMAIL PROTECTED] wrote: On Apr 10, 2008, at 9:04 PM, Laimonas Simutis wrote: Hey, This is my first cocoa projects so I am kind of finding my way around the framework. The question I have is maybe more related to

Re: is this badly written code?

2008-04-14 Thread John Stiles
The chained approach is tempting since it's short and convenient, so if the code is not prone to failure, I'd say go for it. If you expect that you might need to see intermediate values in the debugger or there are weird edge cases where something might return nil, I'd break it out into

Re: is this badly written code?

2008-04-14 Thread John Stiles
with things like if treeController returned nil instead of a NSArray. NSManagedObject *selectedTreeObject = [self valueForKeyPath:@delegate.mainWindowController.treeController.selectedObjects.lastObject]; On Apr 14, 2008, at 10:05 PM, John Stiles wrote: The chained approach is tempting since

Re: Using the debugger with local variables was Re: is this badly written code?

2008-04-15 Thread John Stiles
IS makes a good point. Moreover, if you have some method which has a side effect or which might not return the same result every time, po is no good for debugging it. These simplistic examples (creating a URL from a string) will work the same no matter how many times you execute them, but a

Re: binary search trees binning

2008-04-15 Thread John Stiles
Hmm, setdouble sounds a lot easier than this to me. Just use insert to put all the doubles into the set (one line), then use lower_bound to find the delineations between each group (another one-liner, though of course you'll need to loop over the number of groups you want). Then the distance

Re: binary search trees binning

2008-04-16 Thread John Stiles
Jean-Daniel Dupas wrote: Le 16 avr. 08 à 00:07, John Stiles a écrit : Hmm, setdouble sounds a lot easier than this to me. Just use insert to put all the doubles into the set (one line), then use lower_bound to find the delineations between each group (another one-liner, though of course

Re: binary search trees binning

2008-04-16 Thread John Stiles
Foundation is just ugly in comparison... :) Michael Ash wrote: On Wed, Apr 16, 2008 at 1:20 PM, John Stiles [EMAIL PROTECTED] wrote: The difference is, in STL, if you want an array where you can remove from the beginning, you would never use vector anyway. You'd use deque, which has different

-charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
I have an NSEvent and I need to know what key the user has pressed, minus any of the modifiers. NSEvent -charactersIgnoringModifiers seems like a good place to start, but it has one serious flaw—it does not ignore the Shift key. So, for instance, it won't change ~ to `, ! to 1 or { to [. I

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
timeframe. John Stiles wrote: Sweet, I will take a look at this and post back when I have results or questions. Thanks! Greg Titus wrote: I think you'd ask the NSEvent for its -keyCode, then pass that key code to UCKeyTranslate() with all the modifier key state (including shift) turned off

RE: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
I'm currently cribbing from here: http://lists.apple.com/archives/carbon-dev/2005/May/msg01062.html And I got rid of the non-uchr section. I can require Leopard in this case. From: Jean-Daniel Dupas [mailto:[EMAIL PROTECTED] Sent: Thursday, April 17, 2008 9:37 AM To: John Stiles Cc

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
with low-ASCII values, i.e. numbers under 32. I guess I could implement a hybrid approach where I only use UCKeyTranslate if the character appears to be letters or punctuation...? Seems doable but makes me wonder if I'm going down the wrong path. Is there a better way? John Stiles wrote: Sweet, I

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
version of another character. I'd go for the actual character and its meaning, not the key. Best, Hank On Apr 17, 2008, at 12:02 PM, John Stiles wrote: I have an NSEvent and I need to know what key the user has pressed, minus any of the modifiers. NSEvent -charactersIgnoringModifiers seems

Simulating menu bar blink in Cocoa

2008-04-17 Thread John Stiles
As previously explained here, I'm handling hotkeys in my app via custom code in order to work around some AppKit bugs. How can I simulate the menu-title blink effect using Cocoa? In Carbon, it's FlashMenuBar(menuID) but I don't see a Cocoa equivalent.

Re: Simulating menu bar blink in Cocoa

2008-04-17 Thread John Stiles
Randall Meadows wrote: On Apr 17, 2008, at 11:54 AM, John Stiles wrote: As previously explained here, I'm handling hotkeys in my app via custom code in order to work around some AppKit bugs. How can I simulate the menu-title blink effect using Cocoa? In Carbon, it's FlashMenuBar(menuID

Re: Simulating menu bar blink in Cocoa

2008-04-17 Thread John Stiles
John Stiles wrote: Randall Meadows wrote: On Apr 17, 2008, at 11:54 AM, John Stiles wrote: As previously explained here, I'm handling hotkeys in my app via custom code in order to work around some AppKit bugs. How can I simulate the menu-title blink effect using Cocoa? In Carbon, it's

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
, John Stiles wrote: Quick question: in Leopard, are there any keyboards left which don't have a uchr? I found some sample code which includes a fallback case for if no 'uchr' resource is found (it uses plain KeyTranslate in this case) and I'm wondering whether this is still relevant

Re: -charactersIgnoringModifiers and the shift key

2008-04-17 Thread John Stiles
] initWithBytes:singleChar length:1 encoding:CFStringConvertEncodingToNSStringEncoding(keyboardEncoding)] autorelease]; } return result; } @end John Stiles wrote: Hmm, OK. I guess there's no harm in leaving

NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles
The docs for -editColumn:row:withEvent:select: ominously claim: The row at rowIndex must be selected prior to calling editColumn:row:withEvent:select:, or an exception will be raised. I'm implementing a subclass of NSTableView which behaves a little more like an Excel spreadsheet—it

Re: Simulating menu bar blink in Cocoa

2008-04-18 Thread John Stiles
equivalent and no target or action. Then use NSMenu -performKeyEquivalent: to simulate its selection. Wow, great choices here :| I'm going to try #2 first since it's not SPI. I'll inform the list of the results. John Stiles wrote: John Stiles wrote: Randall Meadows wrote: On Apr 17, 2008

[SOLVED] Simulating menu bar blink in Cocoa

2008-04-18 Thread John Stiles
]; } John Stiles wrote: Reading the list archives a little more, it looks like there may be two ways to do this: - _NSHighlightCarbonMenu and _NSUnhighlightCarbonMenu are SPIs which take an NSMenu* and do exactly what you'd expect - You can add a fake temporary menu item to your menu

Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles
on the header. Fortunately I don't need to worry about that in this case. Not a problem. But this should get you started, hopefully. -Ben -- Ben Lachman Acacia Tree Software http://acaciatreesoftware.com [EMAIL PROTECTED] 740.590.0009 On Apr 18, 2008, at 1:55 PM, John Stiles wrote: The docs

Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-18 Thread John Stiles
Ben Lachman wrote: Well, you should be able to just override the drawing code, since thats really your problem. Going directly against the docs, while it may work fine now, is playing with fire in my opinion. Yeah… that's why I posted :) I was hoping to get a oh yeah, that only applies if

Re: Simulating menu bar blink in Cocoa

2008-04-19 Thread John Stiles
No, that's not the problem. The problem is that some combinations simply don't work. For instance, just as a random example, AppKit does not match option+, or shift+`. (Haven't tried adding command but offhand I don't have any reason to think that this would fix it.) My app supports

Re: [SOLVED] Simulating menu bar blink in Cocoa

2008-04-19 Thread John Stiles
Could you do something else to cause VoiceOver to explicitly say the string you want it to? Martin Wierschin wrote: The fake temporary item solution actually works pretty well. It's the last thing I'd call elegant, but here's how you can blink a menu title in Cocoa. Unfortunately that

Re: NSTextfields and keyboard equivalents - am I missing something?

2008-04-21 Thread John Stiles
In The Path Of Key Events in the URL you posted, the #1 item in the list is key equivalents. AppKit checks keyDown events to see if command is held; if it is, it tries to match it against the menus before passing it through the responder chain. I think your best bet is to dim your menu item or

Re: NSTableView -editColumn:row:withEvent:select: question

2008-04-21 Thread John Stiles
Corbin Dunn wrote: On Apr 18, 2008, at 3:37 PM, John Stiles wrote: Ben Lachman wrote: Well, you should be able to just override the drawing code, since thats really your problem. Going directly against the docs, while it may work fine now, is playing with fire in my opinion. Yeah

SynchroScrollView

2008-04-21 Thread John Stiles
Has anyone gotten this example to work in Leopard? http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html I just tried it and I'm having terrible luck. The view is just blanking itself out immediately. I can get it to sort-of work if I

Re: SynchroScrollView

2008-04-21 Thread John Stiles
that is shrunk to a degenerate rectangle loses its position size) John Stiles wrote: Has anyone gotten this example to work in Leopard? http://developer.apple.com/documentation/Cocoa/Conceptual/NSScrollViewGuide/Articles/SynchroScroll.html I just tried it and I'm having terrible luck

Re: SynchroScrollView

2008-04-21 Thread John Stiles
for RBSplitView? I've seen web posts indicating that it exists but I can't find it. John Stiles wrote: I found thee things which, in conjunction, solve the problem: 1 - Rewrite synchronizedViewContentBoundsDidChange as follows. -scrollToPoint seems broken. (I am clamping the scroll view

Re: SynchroScrollView

2008-04-21 Thread John Stiles
NM that last part, I found the plugin. For the archives, it's at http://brockerhoff.net/src/RBSplitView.ibplugin.zip Sorry, all, for the multiple replies-to-self here :) John Stiles wrote: Oh, there was a fourth problem actually. This doesn't work in all cases: NSRect changedBounds

Re: NSTextfields and keyboard equivalents - am I missing something?

2008-04-22 Thread John Stiles
Mattias Arrelid wrote: On Mon, Apr 21, 2008 at 7:05 PM, John Stiles [EMAIL PROTECTED] wrote: In The Path Of Key Events in the URL you posted, the #1 item in the list is key equivalents. AppKit checks keyDown events to see if command is held; if it is, it tries to match it against

Re: Resource Fork - is this a good use/the right thing to do?

2008-04-23 Thread John Stiles
Thirded. Matt Gough wrote: I'd second that. The OS (well, Finder) also adds things to the resource fork of files (custom icons, info about which app to open a file with when you changed it from the default etc). Just as long as you respect the existing contents this is exactly where you

Re: IB3 can't find my class

2008-04-23 Thread John Stiles
Nick Zitzmann wrote: On Apr 23, 2008, at 4:04 PM, John Stiles wrote: I have a class declared in code which, until recently, didn't have any IBActions in it. Recently I added some, and went to IB3, but it didn't notice that I had added the actions. I had to manually add them via the + button

Re: NSTextView text coloring problem

2008-04-24 Thread John Stiles
Is the $ usage an extension? That doesn't sound like regular C to me. Alastair Houghton wrote: On 24 Apr 2008, at 16:10, Dave Jewell wrote: On 24 Apr 2008, at 8:42 am, Graham Cox wrote: Aside: your ivars shouldn't start with an underscore - Apple reserves such names for its own classes.

Re: Core Animation Deadlock

2008-04-24 Thread John Stiles
You could also show any other thread stuck trying to lock a mutex? I assume there's another thread holding this lock or stuck trying to lock something else. Colin Cornaby wrote: Hi, I'm currently trying to track down a deadlock. After adding a series of layers, CoreAnimation deadlocks here

  1   2   >