From: "Adam Christopher Lawrence" Newsgroups: comp.os.msdos.djgpp Subject: Allegro: problem with MENU structures Date: Sat, 21 Mar 1998 02:52:19 -0500 Organization: Interlog Internet Services Lines: 54 Message-ID: <6evrjg$5mn$1@news.interlog.com> NNTP-Posting-Host: ip203-139.cc.interlog.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I am having difficulties getting Allegro menus working correctly. I have had luck with popup menus, but making the conversion to drop-down menus has this far been impossible. (using Allegro 3.0, coding in C++) Code fragment: MENU parameters_menu[] = { {"Adjust...", AdjustParams, NULL, NULL, NULL}, // AdjustParams is a declared function {"Reset", ResetParams, NULL, NULL, NULL}, // ResetParams is a declared function {NULL, NULL, NULL, NULL, NULL} }; MENU menu[] = { {"Parameters", NULL, parameters_menu, NULL, NULL}, {"Quit", NULL, NULL, D_EXIT, NULL}, {NULL, NULL, NULL, NULL, NULL} }; DIALOG ui_dialog[] = { {d_menu_proc, 0, 0, 0, 0, 0, 0, 0, D_EXIT, 0, 0, menu, 0, 0}, {NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; Using the above, when I call ret = do_dialog(ui_dialog, 0); // assume that ret is a declared 'int' ... the dialog never ends. There is no execution beyond the dialog handler, and I have to CTRL+ALT+END to get control back. I have tried a few variations on the code: adding 'D_EXIT' and 'D_CLOSE' to the 'flags' field of the individual child menu items, as in: MENU parameters_menu[] = { {"Adjust...", AdjustParams, NULL, D_CLOSE, NULL}, {"Reset", ResetParams, NULL, D_CLOSE, NULL}, {NULL, NULL, NULL, NULL, NULL} }; ... that does nothing. Changing from D_EXIT to D_O_K or D_CLOSE in the {d_menu_proc...} portion does nothing. I cannot see past this problem, and the Allegro documentation seems quite confusing and vague in this respect. Supposedly, the child menu items can be used to call functions directly (at least the docs imply that) - that it what I was trying to do with this code. Even if I have to call the functions myself based on callback values, that's fine. I just want the dialog to co-operate, that's all. Any advice would be immensely appreciated!