Creating a Carbon window with PICT controls

I have a window using two PICT controls in a Carbon app. I have provided the resource IDs which exist in my old resource file and IB shows the picts just fine in the design window. However, when I run my application and call the CreateWindowFromNib(), it fails with an error saying it cannot find the resource (-10962). Well, the error description is misleading because it says it couldn't find the window when really it seems it couldn't find my two resource PICTs but probably found the window just fine.

How can I fix this? Where can I put my two PICT resources so that this call can find it? I tried putting the PICT files into my Resources in Xcode but IB doesn't seem to notice them. I can't even find any search results on the Apple dev site for "HIPictureView" (the name displayed in IB for the PICT control).

MacBook Pro, Mac OS X (10.5.5)

Posted on Mar 6, 2009 6:41 PM

Reply
8 replies

Mar 6, 2009 11:42 PM in response to RedWolf

I still have PICTs because my application previously ran under Mac OS 7-9 and I am now biting the bullet and removing pre OS X support and updating to use the newer APIs. The window in question is my About window which has has two PICT resources in them. I haven't figured out how to do it "easier" in the newer APIs.

In any case, I have solved my initial problem. I had an old .xib file in my resources which I guess was overriding my .nib which I was using in IB. Once I removed the .xib file, then it was able to find my window in the .nib.

This though now brings up another issue. My About window has mostly static text fields and if I set the Brush to Document, all the static text controls appear dimmed. If I set the Brush to Dialog, this doesn't happen but I really want it to have the white background. I have a window event handler but I'm only catching the close event. All the static text controls are enabled in IB. There's something with the standard window event handler that is causing this dimmed text behaviour but I haven't figured out exactly what it is.

Mar 6, 2009 11:44 PM in response to RedWolf

Leaving aside the question of why you would use PICTs... bear in mind that the word "resource" has two meanings in the Mac world. The more general, and more recent, meaning, is basically any piece of data that you want to stick in the Resources folder within the application package. The older meaning is a piece of data accessed via the Resource Manager APIs. The picture control uses the latter kind of resource. So, you need to make sure that your picture resources are included in a "Build ResourceManager Resources" build phase in your Xcode target.

Mar 7, 2009 12:02 AM in response to RedWolf

RedWolf wrote:
This though now brings up another issue. My About window has mostly static text fields and if I set the Brush to Document, all the static text controls appear dimmed. If I set the Brush to Dialog, this doesn't happen but I really want it to have the white background. I have a window event handler but I'm only catching the close event. All the static text controls are enabled in IB. There's something with the standard window event handler that is causing this dimmed text behaviour but I haven't figured out exactly what it is.


If you look at the window in the Carbon simulator in IB, do you see that effect? I don't.

Mar 8, 2009 10:39 PM in response to James Walker1

James Walker1 wrote:
Leaving aside the question of why you would use PICTs... bear in mind that the word "resource" has two meanings in the Mac world. The more general, and more recent, meaning, is basically any piece of data that you want to stick in the Resources folder within the application package. The older meaning is a piece of data accessed via the Resource Manager APIs. The picture control uses the latter kind of resource. So, you need to make sure that your picture resources are included in a "Build ResourceManager Resources" build phase in your Xcode target.


Yup, my target has the "Build ResourceManager Resources" build phase and uses my ResEdit built resource file (which I am no longer changing). I converted one of my PICT resources to a PNG and put it into my Resources folder in Xcode but IB doesn't seem to see it so I still haven't figured out yet how I get IB to see images that I can then put into Carbon dialog windows.

Mar 8, 2009 10:43 PM in response to James Walker1

James Walker1 wrote:
RedWolf wrote:
This though now brings up another issue. My About window has mostly static text fields and if I set the Brush to Document, all the static text controls appear dimmed. If I set the Brush to Dialog, this doesn't happen but I really want it to have the white background. I have a window event handler but I'm only catching the close event. All the static text controls are enabled in IB. There's something with the standard window event handler that is causing this dimmed text behaviour but I haven't figured out exactly what it is.


If you look at the window in the Carbon simulator in IB, do you see that effect? I don't.


Actually I do see the effect as well in the Carbon simulator where all my static text is dimmed if I use the Document Brush. I don't understand why it would be dimmed if I have marked the static text as "enabled" in IB.

Mar 8, 2009 11:51 PM in response to RedWolf

RedWolf wrote:
Actually I do see the effect as well in the Carbon simulator where all my static text is dimmed if I use the Document Brush. I don't understand why it would be dimmed if I have marked the static text as "enabled" in IB.


Weird. Can you give me step by step instructions to reproduce this behavior, starting with creating a new empty Carbon window? By the way, what version of IB are you using?

Mar 10, 2009 7:16 PM in response to James Walker1

James Walker1 wrote:
RedWolf wrote:
Actually I do see the effect as well in the Carbon simulator where all my static text is dimmed if I use the Document Brush. I don't understand why it would be dimmed if I have marked the static text as "enabled" in IB.


Weird. Can you give me step by step instructions to reproduce this behavior, starting with creating a new empty Carbon window? By the way, what version of IB are you using?


Well, I tried to recreate the problem but cannot, at least not on my first attempt. I actually recreated the window from scratch with the exact same content and now I do not get the dimmed static text. I cannot see what the difference is between the working and "non-working" version of the window. I am using IB 3.1.2.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Creating a Carbon window with PICT controls

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.