Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!munnari.oz.au!sirius.ucs.adelaide.edu.au!augean!e4ajwake From: e4ajwake@augean.ua.OZ.AU (Wakefield) Newsgroups: comp.sys.amiga.tech Subject: Problem with Menu Events Keywords: Menu Events Message-ID: <906@augean.ua.OZ.AU> Date: 30 Aug 90 05:52:20 GMT Lines: 76 Dear Gurus, (or similar) I have a problem with intuition returning the address of a menu item when the item causes an event. The code that I am using is shown below, cut down of course. The file "menu.h" contains all the menu and screen etc structures required to run the program. I have previously been using the class & code fields to extract the menu item, and used switch statements to recover the menu item and call the apporpriate function (replaced here by printf's). However it seems that it should be possible to use the code outlined below to do this more efficently and simply. The problem: The address field of the message structure is alays ZERO!!! Questions: Is what I am trying to do possible ? Has anyone out there done this before ? Does anyone have some sample code ? Is there a simple solution ? Now the code... #include "menu.h" void HandleEvent(); main() { APTR address; struct IntuiMessage *message; for(;;) { Wait(1L << MyWindow1->UserPort->mp_SigBit); while(message = (struct IntuiMessage *) GetMsg(MyWindow1->UserPort)) { address = message->IAddress; ReplyMsg(message); HandleEvent(address); } } void HandleEvent(object) APTR object; { if (object == (APTR)&MenuItem8) { printf("about function\n"); return; } if (object == (APTR)&MenuItem9) { printf("quit function\n"); return; } } Notes: ------ MenuItem8 is the about item. MenuItem9 is the quit item. these both have values which are non zero and seem reasonable, so I think that they are OK. Mail any hints/abuse/suggestions/code/etc... to e4ajwake@augean.ua.oz.au Thanks in advance Alex Wakefield. ( Electronic & Electrical Engineering Dept, ) ( University of Adelaide, South Australia. )