[comp.sys.apollo] popup in dialog

wcwang@iuvax.cs.indiana.edu (08/17/87)

From: Bill Wang <wcwang@iuvax.cs.indiana.edu>



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.

I tried disable the tasks associated with the techs, but no luck at
all.  I did call apollo 800 number and got some answers like "try to
disable the tasks" and it never worked.

Could someone give me some insights on this or is it not possible
to do what I wanted to do?

Thanks in advance.

Bill Wang
Speech & Hearing Center
Indiana University
Bloomington, IN 47405

UUCP  = {ihnp4,seismo,cbosgd}!iuvax!wcwang
CSNET = wcwang@indiana
ARPA  = wcwang@iuvax.cs.indiana.edu
Phone = (812) 335-0714

hays@apollo.uucp (John Hays) (08/18/87)

In article <3064@iuvax.UUCP> wcwang@iuvax.cs.indiana.edu writes:
>From: Bill Wang <wcwang@iuvax.cs.indiana.edu>
>
>
>
>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.
>

Bill,

Try this.

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.

Let me know if this solves your problem.

John D. Hays, Consultant
Corporate Systems Engineering

apollo!hays@eddie.mit.edu

-- 
John D. Hays, Consultant, Corporate Systems Engineering    | My opinions are my
Apollo Computer Inc. - Chelmsford, MA - USA                | own -- If anyone
ARPA: apollo!hays@EDDIE.MIT.EDU // UUCP: apollo!hays       | really cares!
PACKET RADIO: KD7UW @ K1UGM // CIS: 72725,424 GEnie: KD7UW // PO Box 21, 01824

speyer@apollo.uucp (Bruce Speyer) (08/18/87)

>>From: Bill Wang <wcwang@iuvax.cs.indiana.edu>
>>
>>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 => <ACTIVATE exit_tasks>  ; END
                            {user selected exit icon}
    exit_save := NULL :     COMP => <CALL saveit ; RETURN> ; END
                            {user is saving and exiting}
    exit_quit := NULL :     COMP => <CALL abortit ; RETURN>; END
                            {cleanup and quit without save}
    exit_cancel := NULL :   COMP => <DEACTIVATE exit_tasks>; 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 SHOW> {initial layout window}
  exit_tasks ACTIVATE   => <exit_popup SHOW>     {either from .dps or program}
  exit_tasks DEACTIVATE => <exit_popup POPDOWN>  {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   => <initial_layout BE_CURRENT_CHILD>
  exit_tasks ACTIVATE  => <exit_row       BE_CURRENT_CHILD>
                {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

wcwang@IUVAX.CS.INDIANA.EDU (Bill Wang) (08/19/87)

From wcwang Tue Aug 18 09:30:55 1987
Date: Tue, 18 Aug 87 09:30:47 est
From: Bill Wang <wcwang>
To: pircher@mis.ucsf.edu, wcwang@iuvax.cs.indiana.edu
Subject: Re:  dialog popus
Status: R

It's a pretty good suggestion, and in normal case it would work.

But if I have a error condition during the c-procedure process,
and I want to have a error popup on the top of the current
tech, then when it finishes, the current popup disapears
and it leaves the user without the error msg at all (actually
it gives the user about 1 second to look at the msg :-) ).

That's why I want to have control of the popups inside my 
c/pascal/fortran programs, so I would have better control over
what should be done.

Thanks again for the reply and if you have any idea howto
solve my program, please mail to me directly.

by the way according your signature, you are in uc berkeley.
But this mail came from uc sf.


Bill Wang
Speech & Hearing Center, Indiana University, Bloomington, IN 47405

UUCP  = {ihnp4,seismo,cbosgd}!iuvax!wcwang
CSNET = wcwang@indiana
ARPA  = wcwang@iuvax.cs.indiana.edu
Phone = (812) 335-0714