Initializing NSWindow with Carbon window
I have a legacy builder class that creates a Carbon window and I want to initialize an NSWindow with this WindowRef. I have a method on the builder GetProduct() that hands out the WindowRef. If I use commands like the following WindowRef w = builder.GetProduct(); ShowWindow( w ); SelectWindow( w ); then the window becomes displayed. If I use the following: NSWindow *window = [ [ NSWindow alloc ] initWithWindowRef: builder.GetProduct() ]; [ window makeKeyAndOrderFront ]; the window DOES not become displayed. Are there some Carbon Events on the WindowRef I should be handling? Or am I forgetting to set some attributes on the NSWindow that I should be? Cheers, --aj ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Initializing NSWindow with Carbon window
On 30/01/2011, at 9:17 PM, Andrew James wrote: > [ window makeKeyAndOrderFront ]; This should be [window makeKeyAndOrderFront:nil]; (or you could pass a valid sender, though I suspect it's ignored) --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Implementing a Find menu item like Safari? [SOLUTION]
On 28/01/2011, at 14:43, Ben Golding wrote: > Safari has a really nice "Find" bar that scrolls down from the title pane of > the window. I'd like to do something like that in an application that I'm > developing but I can't find out whether that's generally available and how to > use it. Thanks to couple of short but extremely informative e-mails from Uli Kusterer I know how to do this now. The first thing to do is to wrap the content of the window in a single NSView. In IB, select all in your window and then enclose that in a custom view which doesn't need a subclass. We'll change the size of that view in the window to leave space at the top of the window's content view to leave space for the find "panel". In IB, create a new window/panel and populate it with the NSSearchField and other buttons. Hook those up to the actions/outlets/bindings in file's owner that trigger the appropriate actions and make it the size that you want it to be. You need to add an outlet in File's owner to this window's view so we can add it to the window. Here's the piece of code I used. CsvContentView is the view enclosing the main window's content, findPanelView is the view containing my find panel components, csvWindow is the window containing csvContentView (I might have used the window manager to get this but a link using IB seemed easier). - (void)makeFindPanelVisible { NSRect contentRect = [csvContentView frame]; [csvContentView setFrameSize:NSMakeSize(contentRect.size.width, contentRect.size.height - [findPanelView bounds].size.height)]; [findPanelView setFrame:NSMakeRect(contentRect.origin.x, [[csvWindow contentView] frame].size.height - [findPanelView bounds].size.height, contentRect.size.width, [findPanelView bounds].size.height)]; [[csvWindow contentView] addSubview:findPanelView]; } - (IBAction)closeFindPanelAction:(id)sender { NSRect contentRect = [csvContentView frame]; // extra retain to stop findPanelView being released (for some reason) [[findPanelView retain] removeFromSuperviewWithoutNeedingDisplay]; [csvContentView setFrameSize:NSMakeSize(contentRect.size.width, contentRect.size.height + [findPanelView bounds].size.height)]; _isFindPanelVisible = NO; } I haven't implemented animation though I'd like to, I'm trying to get the functionality working first. The second part of my question about highlighting the found string as Safari does can be done using -showFindIndicatorForRange:. That method only exists on NSTextView so it's not obvious (to me) how to use that to highlight the matching field in an NSTableView which is what I'm using to display my data. I'm just selecting the matching text instead. Hope this helps someone. There isn't much code but it takes a little fiddling to get it right. Ben. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Help Book authoring tool?
Hello, I would like to solicite some recommendations for an authoring tool to create help books. I'm looking for a preferably freeware application, with a decent html editor. Thanks, -- Luc Van Bogaert luc.van.boga...@me.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[MEET] February CocoaHeads Mac Developer Meetings
Greetings, CocoaHeads is an international Mac programmer's group. Meetings are free and open to the public. We specialize in Cocoa, but everything Mac/iPhone programming related is welcome. Canada Ottawa/Gatineau, Ontario - Thursday, February 10, 2011 19:00 Germany Hamburg - Thursday, February 3, 2011 19:00 Sweden Göteborg - Thursday, February 10, 2011 19:00 U.S.A. Albany, New York - Thursday, February 24, 2011 19:00 Atlanta, Georgia - Thursday, February 10, 2011 19:00 Boston, Massachusetts - Thursday, February 10, 2011 19:00 Boulder, Colorado - Tuesday, February 8, 2011 17:00 Chattanooga, Tennessee - Saturday, February 12, 2011 09:00 Colorado Springs, Colorado - Thursday, February 10, 2011 19:00 Columbia, Maryland - Thursday, February 10, 2011 19:00 Des Moines, Iowa - Thursday, February 10, 2011 19:00 Fayetteville, Arkansas - Thursday, February 10, 2011 18:00 Lake Forest, California - Wednesday, February 9, 2011 19:00 New York, New York - Thursday, February 10, 2011 18:00 Pittsburgh, Pennsylvania - Thursday, February 17, 2011 19:30 Portland, Oregon - Wednesday, February 23, 2011 19:00 Sacramento, California - Wednesday, February 2, 2011 19:00 United Kingdom Nottingham - Wednesday, February 23, 2011 18:30 Some chapters may have yet to post their meeting for next month. Meeting times may change. Locations and more information here: http://cocoaheads.org Also be sure to check for an NSCoder Night in your area: http://nscodernight.com/ Steve Silicon Valley CocoaHeads___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Add a view (xib) to a project
Hey everyone, first of all i'd like to thank all of you for this awesome list/community. I hope that i can help you sometimes... But now to my question. Can anyone of you explain me (slowly;)) how to add another view (.xib) file to my iPhone project? I tried several things, but none worked for me. Thanks in advance. Max Cologne, GER___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Initializing NSWindow with Carbon window
For once I actually should have "cut-and-paste": NSWindow *wrapper = [ [ NSWindow alloc ] initWithWindowRef: carbonBuilder.GetProduct() ]; [ wrapper makeKeyAndOrderFront: self]; I did have the sender being sent correctly. Window still does not show with this approach. Nice catch though. I'm going to keep trying. Going to see if makeKeyAndOrderFront is causing any Carbon Events to be generated for the wrapped window. I may also take the route of subclassing NSWindowController with something like WrappedCarbonWindowController and look into subclassing methods like showWindow. Implementing a window delegate my also help. I've got options that I'm going to explore. Cheers, --aj From: Graham Cox To: Andrew James Cc: list-cocoa-dev Sent: Sun, January 30, 2011 3:04:38 AM Subject: Re: Initializing NSWindow with Carbon window On 30/01/2011, at 9:17 PM, Andrew James wrote: > [ window makeKeyAndOrderFront ]; This should be [window makeKeyAndOrderFront:nil]; (or you could pass a valid sender, though I suspect it's ignored) --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Add a view (xib) to a project
1) Click once the Xcode icon in your Dock to ensure Xcode is the frontmost application. 2) From the menu bar, choose File > "New...". You will be presented with a window titled "New File". 3) Locate the column on the left hand side of the window which just opened and the section of the column labelled "iOS". 4) Click the words "User Interface" underneath the "iOS" section. 5) To the right, choose what type of new xib file you would like to add to your project by clicking the appropriate icon. 6) Directly underneath the table of new xib file types, ensure the popup menu labelled "Product" reads "iPhone". 7) Click the button labelled "Next" at the bottom right of the window. 8) Once you have named the file it will appear in the "Groups & Files" section on the left hand side of your project window. Hope this helps, Kiel On 31/01/2011, at 8:59 AM, Max Stottrop wrote: > Hey everyone, > first of all i'd like to thank all of you for this awesome list/community. I > hope that i can help you sometimes... > But now to my question. Can anyone of you explain me (slowly;)) how to add > another view (.xib) file to my iPhone project? I tried several things, but > none worked for me. Thanks in advance. > > Max > Cologne, GER___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com > > This email sent to kiel.gill...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Initializing NSWindow with Carbon window
On 31/01/2011, at 3:02 PM, Andrew James wrote: > For once I actually should have "cut-and-paste": > > NSWindow *wrapper = [ [ NSWindow alloc ] initWithWindowRef: > carbonBuilder.GetProduct() ]; > [ wrapper makeKeyAndOrderFront: self]; > > I did have the sender being sent correctly. Window still does not show with > this approach. Nice catch though. > > I'm going to keep trying. Going to see if makeKeyAndOrderFront is causing any > Carbon Events to be generated for the wrapped window. > > I may also take the route of subclassing NSWindowController with something > like > WrappedCarbonWindowController and look into subclassing methods like > showWindow. > Implementing a window delegate my also help. I've got options that I'm going > to explore. There are some simpler things to try first. Does carbonBuilder.GetProduct() actually return anything? Is the variable set to something after creating the window? If yes to both, try looking at properties of , such as its frame. That will tell you if it's actually supposed to be on the screen. If the window object isn't created, it might be that the carbon window type and/or combination of flags isn't supported, so you may have to go back and modify the carbon window you return to something currently legal. (I'm guessing here, I haven't had cause to do this myself, but AFAIK -initWithWindowRef: is not broken). Adding a window delegate isn't required to show a window, and adding one is only going to complicate matters at this stage. Also, I don't know that carbon events are generated even if NSWindow was inited with a carbon window. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTableView selecting text within a cell
I have an app with a NSTableView where the data is presented to the user. When the user hits "Find", I'd like to be able to scroll the table view to the visible cell (easy enough) and then select the range that matched within that field (not so easy). At present, my code looks like: NSCell *cell = [csvTableView preparedCellAtColumn:col row:row]; NSText *textEditor = [csvWindow fieldEditor:YES forObject:cell]; NSLog(@"Match: row %@, field %@, range(%d, %d)", [match row], [match field], [match range].location, [match range].length); [csvTableView scrollRowToVisible:row]; [csvTableView scrollColumnToVisible:col]; [textEditor setSelectedRange:[match range]]; I feel like I need to between getting the textEditor for the window and calling -setSelectedRange:, I just don't know what. Ben. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Initializing NSWindow with Carbon window
I've done some investigating and still getting the behavior that the window does not display from the code below Interestingly, if you look at the two ShowWindow/SelectWindow pairs. I will see the window when the first one is uncommented only. I will not see the window when the second set is uncommented only. ODD. Don't know if this provides any insight. WindowRef carbonWindow = carbonBuilder.GetProduct(); // If these are only Show/Select uncommented, window will display //ShowWindow( carbonWindow ); //SelectWindow( carbonWindow ); NSWindow *wrapper = [ [ NSWindow alloc ] initWithWindowRef: carbonWindow ]; // If these are only Show/Select uncommented, window will NOT display //ShowWindow( carbonWindow ); //SelectWindow( carbonWindow ); NSLog( @"Window frame = %@", NSStringFromRect( [ wrapper frame ] ) ); NSLog( @"Window content frame = %@", NSStringFromRect( [ [ wrapper contentView ] frame ] ) ); NSLog( @"Window alpha value = %f", [ wrapper alphaValue ] ); NSLog( @"Window visibility = %d", [ wrapper isVisible ] ); NSLog( @"Carbon window visibility = %d", IsWindowVisible( carbonWindow ) ); [ wrapper makeKeyAndOrderFront: self]; NSLog( @"Window frame = %@", NSStringFromRect( [ wrapper frame ] ) ); NSLog( @"Window content frame = %@", NSStringFromRect( [ [ wrapper contentView ] frame ] ) ); NSLog( @"Window alpha value = %f", [ wrapper alphaValue ] ); NSLog( @"Window visibility = %d", [ wrapper isVisible ] ); NSLog( @"Carbon window visibility = %d", IsWindowVisible( carbonWindow ) ); Here's the output I see: 2011-01-30 23:41:28.379 Empath[1126:a0f] Window frame = {{599, 246}, {776, 687}} 2011-01-30 23:41:28.381 Empath[1126:a0f] Window content frame = {{12, 0}, {764, 687}} 2011-01-30 23:41:28.381 Empath[1126:a0f] Window alpha value = 1.00 2011-01-30 23:41:28.382 Empath[1126:a0f] Window visibility = 0 2011-01-30 23:41:28.382 Empath[1126:a0f] Carbon window visibility = 0 2011-01-30 23:41:28.386 Empath[1126:a0f] Window frame = {{599, 246}, {776, 687}} 2011-01-30 23:41:28.386 Empath[1126:a0f] Window content frame = {{12, 0}, {764, 687}} 2011-01-30 23:41:28.387 Empath[1126:a0f] Window alpha value = 1.00 2011-01-30 23:41:28.387 Empath[1126:a0f] Window visibility = 1 2011-01-30 23:41:28.387 Empath[1126:a0f] Carbon window visibility = 1 But as I've said... still no window. Hrmm. I should say, that the end goal is to be able to have this NSWindow owned by an NSWindowController. The reasoning for this is that I have a factory method that returns an NSWindowController. I'd rather not back down from this and write my own class that does the controlling of Cocoa vs. Carbon windows. --aj - Original Message From: Graham Cox To: Andrew James Cc: list-cocoa-dev Sent: Sun, January 30, 2011 8:18:23 PM Subject: Re: Initializing NSWindow with Carbon window On 31/01/2011, at 3:02 PM, Andrew James wrote: > For once I actually should have "cut-and-paste": > > NSWindow *wrapper = [ [ NSWindow alloc ] initWithWindowRef: > carbonBuilder.GetProduct() ]; > [ wrapper makeKeyAndOrderFront: self]; > > I did have the sender being sent correctly. Window still does not show with > this approach. Nice catch though. > > I'm going to keep trying. Going to see if makeKeyAndOrderFront is causing any > Carbon Events to be generated for the wrapped window. > > I may also take the route of subclassing NSWindowController with something > like > > > WrappedCarbonWindowController and look into subclassing methods like >showWindow. > > Implementing a window delegate my also help. I've got options that I'm going > to explore. There are some simpler things to try first. Does carbonBuilder.GetProduct() actually return anything? Is the variable set to something after creating the window? If yes to both, try looking at properties of , such as its frame. That will tell you if it's actually supposed to be on the screen. If the window object isn't created, it might be that the carbon window type and/or combination of flags isn't supported, so you may have to go back and modify the carbon window you return to something currently legal. (I'm guessing here, I haven't had cause to do this myself, but AFAIK -initWithWindowRef: is not broken). Adding a window delegate isn't required to show a window, and adding one is only going to complicate matters at this stage. Also, I don't know that carbon events are generated even if NSWindow was inited with a carbon window. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com