| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
I started a few days ago development for my first Carbon project.
Everything was going ahead very smoothly until I came across the
Controls
Manager. My problem is that I create a control root and embedded a
control
to it, but when I use IsValidControlHandler() on the handlers of the
new
controls I get that they are invalid.
/* We create our root control */
CreateRootControl(ptrWindowRef,
&(gwndEditorWindow[gushtEditorWindowsCount].ptrRootControlRef));
Be aware that on OS X you do not have to do this, all windows always
have a root control automatically created for you.
Ah, ok that's useful information for a Mac OS X compile. Currently I'm
working on Mac OS 9.2.2.
/* And we load our data displaying control from the resources */
gwndEditorWindow[gushtEditorWindowsCount].ptrDataControlRef =
GetNewControl(128, ptrWindowRef);
/* The next thing to do would be to set it's size according to the
window */
SizeControl(gwndEditorWindow[gushtEditorWindowsCount].ptrDataControlR ef
,
intRight - intLeft,
intBottom - intTop - 15);
ActivateControl(
gwndEditorWindow[gushtEditorWindowsCount].ptrRootControlRef);
if(IsValidControlHandle(
gwndEditorWindow[gushtEditorWindowsCount].ptrDataControlRef))
{
TerminateApplication; /* <--- THIS NEVER HAPPENS, WHY?!? */
}
Some obvious questions...
1. Are you checking for errors? Your sample doesn't show that to be the
case. Remember check_noerr and its ilk from Debugging.h are your
friends.
I've been looking for information on how to debbug a Mac application. My
problem is that I've just switched from Windows development so I am kind of
new to it. To be honest I'm having a really bad time trying to understand
how the documentation works with the apple developer's site, so if you know
a good tutorial on Carbon debugging please, let me know about it.
_______________________________________________2. Is the control actually getting created? Is it visible when the
window is shown?
Yes, the control is there. I created a scrolling textbox and it shows up as
if disabled for some reason. I can actually resize the control and work on
it by using the exactly same ptr I used with the IsValidControlHandle()
function.
3. are you sure nothing is changing "gushtEditorWindowsCount" by theYes, I am sure about this as I went step by step in the debug window to see
time it is getting called (i.e are you looking at the same
ptrDataControlRef field?
how values changed. I thought the same thing at first too.
4. The call to ActivateControl is not needed, new controls are activeThanks for that, I was really wondering about it. The real problem is I
by default
haven't been able to find a good guide regarding the Control Manager use. I
love Apple and all but I find their Control Manager guide to be quite poor
(almost incomplete).
The Window Manager and Event Manager guides were much more complete IMHO.
5. Prove to yourself that IsValidControlHandle works. Pass it somethingYes, I tried this and I get false as well. I was trying to figure out if
you KNOW is not a control. A windowref, or 0xDEADBEEF or whatever.
there's something I need to add to my source (like a header or something)
that I didn't put into it. But my code compiles without errors at all = (
Bryan
Thanks a lot for the quick reply,
Diego Rey
| References: | |
| >Re: Problems with Controls Manager (From: Diego Rey <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.