home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / graphics / avs / 1079 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  3.5 KB

  1. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!usc!hacgate!valkris!hayes
  2. From: hayes@valkris.aero.org (Brian Hayes 74-35 x65129)
  3. Newsgroups: comp.graphics.avs
  4. Subject: Re: Widget control
  5. Message-ID: <24839@hacgate.SCG.HAC.COM>
  6. Date: 22 Jan 93 21:17:40 GMT
  7. References: <147125@lll-winken.LLNL.GOV>
  8. Sender: news@hacgate.SCG.HAC.COM
  9. Organization: Hughes Aircraft Company, EDSG
  10. Lines: 74
  11.  
  12. In article <147125@lll-winken.LLNL.GOV> cabral@lll-crg.llnl.gov (Brian Cabral) writes:
  13. >
  14. >   I am interested in creating a complex AVS widget panel. Specifically, I
  15. >want to have a number of widgets popup as function of the boolean state
  16. >of other widgets on the panel. The only way I see of performing this task
  17. >is to maintain state in the main body of a co-routine and control the
  18. >creation and deletion of the contingent widgets. Does anyone know
  19. >of a better way of doing this or if AVS has a built in facility for handling
  20. >this sort of contingent widget control? I'll listen to the news group
  21. >for the answer. Thanks.
  22.  
  23. Brian:
  24.    What's the problem with your approach?  Sounds okay to me.  I can do
  25.    you one better:  I determine which panel to display in seperate 
  26.    executable written in Ada.  
  27.    But, to provide you with another solution, I _suspect_ that you may be
  28.    able to describe the state dependent panels in a network file(s)
  29.    where the panels may may share common widgets (parameters).  
  30.    The problem with this is
  31.      a) AVS may not allow you to share common widgets across panels and
  32.      b) you'll still have to maintain the state.
  33.    As an alternative suggestion, I suggest you put unique widgets on
  34.    each state dependent panel.  You'll have to name and access each
  35.    widget with a unique name.  For example "HELP Panel 1" and "HELP
  36.    Panel 2." In this example, I want to have the buttons both labeled 
  37.    "HELP"...not "Help Panel 1" and "Help Panel 2." code excerpts are as
  38.    follows:
  39.  
  40.    int example_desc ()
  41.    {
  42.       ...
  43.       param1 = AVSadd_parameter("Help Panel 1", "oneshot", 0, 0, 1);
  44.       param1 = AVSadd_parameter_prop (param1, "title", "string",
  45.       "HELP");
  46.       AVSconnect_widget (param1, "oneshot");
  47.       param2 = AVSadd_parameter("Help Panel 2", "oneshot", 0, 0, 1);
  48.       param2 = AVSadd_parameter_prop (param2, "title", "string",
  49.       "HELP");
  50.       AVSconnect_widget (param2, "oneshot");
  51.      ...
  52.    }
  53.  
  54.    int example_comp (...Help_Panel_1, Help_Panel_2, ...)
  55.    ...
  56.    {
  57.       ...
  58.       if (AVSparameter_changed ("Help Panel 1")) {
  59.     /* Some action...which just so happens to be state dependent
  60.     since the help buttons appear on different panels! :-) */
  61.       } else if (AVSparameter_changed ("Help Panel 2")) {
  62.       ...
  63.       } ...
  64.       ...
  65.    }
  66.  
  67.    Since the panels describe the state by providing the user with the 
  68.    control widgets (and other widgets) applicable only to that state, 
  69.    state dependent action can be obtained without explicity maintaining
  70.    a state.  We retitle the buttons so that the user does not see that 
  71.    he/she/otherwise is manipulating a parameter named differently than 
  72.    it is titled.
  73.  
  74.    The drawback to this approach is that you have lots of widgets.  For
  75.    example if you have 5 panels that share 5 commonly titled oneshots, 
  76.    you need to define 25 uniquely named parameters and have 25 if-AVS-
  77.    parameter-changed statements (thank goodness for copy-cut-and-replace
  78.    =:^)
  79.  
  80.    Brian Hayes
  81.  
  82. -- 
  83. | Brian Hayes        | "Know you analysis and design methodology, |
  84. | (310) 616-5129    |  its strengths and weaknesses!" -B.S.Hayes |
  85. | hayes@hac2arpa.hac.com| <standard disclaimer here>                 |
  86.