Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!apollo!speyer From: speyer@apollo.uucp (Bruce Speyer) Newsgroups: comp.sys.apollo Subject: Re: popup in dialog Message-ID: <36bf1dba.52c6@apollo.uucp> Date: Tue, 18-Aug-87 14:45:00 EDT Article-I.D.: apollo.36bf1dba.52c6 Posted: Tue Aug 18 14:45:00 1987 Date-Received: Thu, 20-Aug-87 04:51:48 EDT Organization: Apollo Computer, Chelmsford, Mass. Lines: 102 >>From: Bill Wang >> >>I have a question about dialog programming in C: >> >>I have a popup which contains a row with some menus and strings, >>what I want to do is that whenever I choose one item in that menu, >>Not only It will call some procedure in C, but also it will popdown >>my original popup. >From: hays@apollo.uucp (John Hays @ Apollo Computer, Chelmsford, MA) > >In the menu technique: > >[SELECT] => <* SELECT;popup_name POPDOWN>; > >where popup_name is the name of the popup you wish to popdown. > >This syntax says: when selected, perform the selection (do 'comp' in associated >task) then popdown the popup. > Bill, John has a good solution if this is indeed the behaviour you wish to see. I'm a believer in controlling the display characterstics as much as possible from the .dps file so I would use it if it does the job. However If you want to control popup and popdown of menus from the C or PASCAL code itself you will indeed need to do activate and deactivates of tasks. Probably what you weren't told was that task you need to activate and deactivate needs to be associated popup technique and in all likelyhood it will be a task that is a task_group. Note that the same goes for oneof techniques except for a slightly different syntax (be_current_child vs show/popdown). Basically you can mix and match as much as you want between controlling the popup or oneof technique in the .dps file and in your c program. Here are some examples from the .dps end. (I wrote the application, in this case, in PASCAL and all it does is do dp_$task_activate and dp_$task_deactivate calls so I'm leaving the code out.) example 1: I have a sensitive application that I don't want to be accidently stopped. So I define an exit menu that pops up when a quit is intended. It is assumed if the user quits from that menu they really mean it. The menu offers the options save and exit, no-save and quit, or drop the menu and continue the application. The menu is popped up in one of four ways: the user selects the exit icon, the user causes a quit fault (usually with a ^Q), an unexpected fault occurs or a severe application error occurs which suspends processing and prompts the user if they want to quit. The user can then select to save or not save and quit or return to processing. If the user causes a quit fault (^Q) when the exit menu is up that is taken to mean no-save and quit immediately. So its necessary to popup the exit menu from both the .dps and the program. APPLICATION_INTERFACE application_name exit_icon_popup := NULL COMP => ; END {user selected exit icon} exit_save := NULL : COMP => ; END {user is saving and exiting} exit_quit := NULL : COMP => ; END {cleanup and quit without save} exit_cancel := NULL : COMP => ; END {simply drop menu, allow next select} exit_tasks := TASK_GROUP : TASKS = (exit_save exit_quit exit_cancel) ; END {remember activating exit_tasks activates each task in its task group too} ALL_TASKS := TASK_GROUP : TASKS = (exit_icon_popup ...) ; END {do dp_$task_activate(all_tasks, status); to initiate from the application} USER_INTERFACE application_name %include "/sys/ins/dialog_user.ins.dps" {define templates like exit_ICON} all_tasks ACTIVATE => {initial layout window} exit_tasks ACTIVATE => {either from .dps or program} exit_tasks DEACTIVATE => {either from .dps or program} exit_icon_popup := interface_ICON : TASK = exit_icon_popup; STRING = "Exit!" ; END {select icon to popup exit menu} exit_save := exit_ICON : TASK = exit_save; STRING = "Save and Exit" ; END exit_quit := exit_ICON : TASK = exit_quit; STRING = "Quit / No-Save" ; END exit_cancel := interface_ICON : TASK = exit_cancel; STRING = "Cancel" ; END exit_row := ROW : CONTENTS = (exit_save exit_quit exit_cancel); BORDER_WIDTH = 4; DIVISION_WIDTH = 2; OUTLINE = ON; PROPORTIONS = (1); END exit_popup := POPUP : CONTENTS = exit_row; END example 2: Lets take example 1 except make it a oneof instead of a popup. Either we want to see the main menu or replace it temporarily with the exit menu. all_tasks ACTIVATE => exit_tasks ACTIVATE => {could trigger an any tasks activate/deactivates from either the .dps file or the C or PASCAL application. have to be careful of the ordering else you might see the previous menu deactivate before its replaced with the new menu} exit_oneof := ONEOF : CONTENTS = (initial_layout exit_row) ; END {exit_oneof can be contained in another structuring tech} good luck, Bruce ARPA: apollo!speyer@EDDIE.MIT.EDU || UUCP: speyer@apollo.UUCP