Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!hbiso!theep!wildcat!steve From: steve@wildcat.UUCP (Steve Holland) Newsgroups: comp.sys.amiga.programmer Subject: Re: Problems with Menu, MenuItem and IntuiText structure declarations Message-ID: Date: 16 Jun 91 00:56:47 GMT References: <28728@know.pws.bull.com> Reply-To: wildcat!steve@alphalpha.com Lines: 63 >In article <28728@know.pws.bull.com> emcphers@manu.cs.vt.edu (Frank McPherson) writes: > >I'm attempting to add a menu to a program I'm in the process of writing. >I have run into a problem. I can't get my initializations of those >structures past the compiler for some reason. Here's what the >declarations look like: > >struct IntuiText quit_text = > { > 0,1, /* FrontPen, BackPen */ > JAM1, /* DrawMode */ > 0,1, /* LeftEdge, TopEdge */ > NULL, /* ITextFont */ > (UBYTE *) "Quit", /* IText */ > NULL /* NextText */ > }; >struct MenuItem quit_item = > { > NULL, /* NextItem */ > 0,0, /* LeftEdge, TopEdge */ > 150,10, /* Width, Height */ > (ITEMTEXT| /* Flags */ > ITEMENABLED| > HIGHNONE), > 0L, /* MutualExclude */ > (APTR) &quit_text, /* ItemFill */ ^^^^^^^^^ > NULL, /* SelectFill */ > NULL, /* Command (keyboard equiv.) */ > NULL, /* SubItem */ > 0 /* NextSelect */ > }; >struct Menu project_menu = > { > NULL, /* NextMenu */ > 0,0, /* LeftEdge, TopEdge */ > 70,10, /* Width, Height */ > MENUENABLED, /* Flags */ > (UBYTE *) "Project", /* MenuName */ > (APTR) &quit_item /* FirstItem */ ^^^^^^^^^ > }; > >I'm trying to declare a menustrip with only one menu (called Project) >and a single selection (called Quit). Both lines which have (APTR) >type casts give me the following error with SAS/C 5.10A: >Error 20: invalid constant expression You can't initialize to a variable in C. Rather, initialize it as NULL and fill it in later. >I'm stuck. Any help will be appreciated. Please reply via email to >avoid wasting bandwidth with what is probably a silly misake on my >part. If you need more of the code in order to help, please ask me >for it. > >Thanks in advance for your help! > >-- Frank McPherson INTERNET: emcphers@manu.cs.vt.edu -- -- ----------->Steve Holland<----------- Internet: wildcat!steve@alphalpha.com| "I never let my schooling get in the USENET: ...!alphalpha!wildcat!steve | way of my education" -Mark Twain