Article View: comp.sys.amiga.tech
Article #12166Re: Programming multiple Menu Selections
From: Kevin Clague
Date: Mon, 10 Apr 1989 13:22
Date: Mon, 10 Apr 1989 13:22
55 lines
2445 bytes
2445 bytes
In article <2124@pur-phy> murphy@newton.physics.purdue.edu (William J. Murphy) writes:
>
>I have been trying to figure out why I have a bug in a program of mine
>which uses/supports multiple menu selections. I have 2 menus, one with one
>item, the other with two items. The FIRST time that I select Menu1 Item1,or
>Menu2 Item2,
>I get locked into a loop with number = 0. The FIRST time that I select Menu2
>Item1, everything from then on works fine.
>
>I have isolated the problem as what is being returned by the function
>number = ItemAddress(main_menu[0], number)->NextSelect;
>
>number is intially given a value from
>message = (struct IntuiMessage *)GetMsg(window->UserPort);
>class = message->Class;
>code = message->Code;
>switch(class)
>{
> case MENUPICK:
> handle_main_menu(code);
> break;
>}
>
>handle_main_menu(number)
>
>From what I have discerned from Mortimore, if number is not a valid
>menuNumber then ItemAddress will return a NULL. Is it correct to trap
>for this potential error condition? Maybe something like this?
>
>if ((number = ItemAddress(main_menu[0], number)-NextSelect) == NULL)
Could this be your problem? ^^^
What you want to do is pass it the addess of your menu chains, not
the contents of the first menu item. Otherwise you seem to be on the
right track.
> number = MENUNULL;
>
>I use (number != MENUNULL) as a conditional test in a while loop.
>
>Finally, I guess I am asking how do others support multiple menu selections
>and is what I am doing flawed.
>Bill Murphy
I've used the same method with good success.
Kevin
--
UUCP: kevin@uts.amdahl.com
or: {sun,decwrl,hplabs,pyramid,seismo,oliveb}!amdahl!kevin
DDD: 408-737-5481
USPS: Amdahl Corp. M/S 249, 1250 E. Arques Av, Sunnyvale, CA 94086
[ Any thoughts or opinions which may or may not have been expressed ]
[ herein are my own. They are not necessarily those of my employer. ]
Technical Details
Message-ID:
<172S26aXLs10100WHNE@amdahl.uts.amdahl.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!apple!amdahl!kevinReferences:
<2124@pur-phy>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!apple!amdahl!kevin From: kevin@uts.amdahl.com (Kevin Clague) Newsgroups: comp.sys.amiga.tech Subject: Re: Programming multiple Menu Selections Message-ID: <172S26aXLs10100WHNE@amdahl.uts.amdahl.com> Date: 10 Apr 89 13:22:15 GMT References: <2124@pur-phy> Reply-To: kevin@amdahl.uts.amdahl.com (Kevin Clague) Organization: Amdahl Corporation, Sunnyvale, CA 94086 Lines: 55