View Full Version : Carbon Help
TheShitX
2005.07.25, 11:15 PM
I need Help with carbon. I am running OS X 10.4 and i am using Xcode 2. I am having trouble because every time that I make an application there is an error with the Menus. I am inable to click them without the program issuing a warning:
ZeroLink: unknown symbol '__Z16doMouseDownEventv'
please could some one help me?
OneSadCookie
2005.07.25, 11:30 PM
It means that you haven't defined
void doMouseDownEvent()
anywhere. Is that function in one of your source files? Is it in a C++ source file? Is the C++ source file in your project? Is it ticked for the target?
HelloWorld
2005.07.25, 11:59 PM
Sorry For the innapropriate name=(.
My code looks like this:
int main(int argc, char* argv[])
{
IBNibRef nibRef;
WindowRef window;
WindowRef window1;
EventRecord Event;
OSStatus err;
EventRef EvntRef;
EventHandlerUPP handlerUPP;
Boolean gotEvent;
err= CreateNibReference(CFSTR("main"), &nibRef);
err = SetMenuBarFromNib(nibRef,CFSTR("MenuBar"));
err = CreateWindowFromNib(nibRef, CFSTR("Window2"), &window1);
ShowWindow(window);
ShowWindow(window1);
SetPortWindowPort(window1);
gQuit=false;
while(!gQuit)
{
gotEvent = WaitNextEvent(everyEvent,&Event,MAX_UNIT32,NULL);
if(gotEvent)
{
doEvents(&Event);
}
}
return 0;
}
void doEvents(EventRecord * Event)
{
switch(Event->what)
{
case mouseDown:
doMouseDownEvent();
break;
case keyDown:
break;
case updateEvt:
break;
case autoKey:
break;
case activateEvt:
break;
case osEvt:
break;
case mouseUp:
break;
}
}
void doMouseDownEvent(EventRecord *EvtRec)
{
WindowPartCode PartCode;
WindowRef windowRef;
SInt32 menuChoice;
PartCode= FindWindow(EvtRec->where,&windowRef);
switch (PartCode)
{
case inMenuBar:
menuChoice=MenuSelect(EvtRec->where);
doMenuChoice(menuChoice);
break;
case inContent:
if (windowRef!=FrontWindow())
SelectWindow(windowRef);
break;
case inDrag:
DragWindow(windowRef,EvtRec->where,NULL);
break;
case inGoAway:
if (TrackGoAway(windowRef,EvtRec->where))
gQuit=true;
break;
}
}
void doMenuChoice(SInt32 MenuChoice)
{
MenuID menuID;
MenuItemIndex MenuItem;
OSErr err;
MenuCommand commandID;
menuID =HiWord(MenuChoice);
MenuItem = LoWord(MenuChoice);
}
*i have not finnished with the menu, this is just handles mouse down events so far.
OneSadCookie
2005.07.26, 12:44 AM
Your function is doMouseDownEvent(EventRecord *EvtRec), but you're calling it with no arguments.
HelloWorld
2005.07.26, 01:07 AM
Thank you Very Much!! It works now! i had also declared it inproperly in the header file.
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.