🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.graphics.avs
Article #278

Re: Widget control

#278
From: Brian Hayes 74-35 x65129
Date: Fri, 22 Jan 1993 21:17
74 lines
3686 bytes
In article <147125@lll-winken.LLNL.GOV> cabral@lll-crg.llnl.gov (Brian Cabral) writes:
>
>   I am interested in creating a complex AVS widget panel. Specifically, I
>want to have a number of widgets popup as function of the boolean state
>of other widgets on the panel. The only way I see of performing this task
>is to maintain state in the main body of a co-routine and control the
>creation and deletion of the contingent widgets. Does anyone know
>of a better way of doing this or if AVS has a built in facility for handling
>this sort of contingent widget control? I'll listen to the news group
>for the answer. Thanks.

Brian:
   What's the problem with your approach?  Sounds okay to me.  I can do
   you one better:  I determine which panel to display in seperate 
   executable written in Ada.  
   But, to provide you with another solution, I _suspect_ that you may be
   able to describe the state dependent panels in a network file(s)
   where the panels may may share common widgets (parameters).  
   The problem with this is
     a) AVS may not allow you to share common widgets across panels and
     b) you'll still have to maintain the state.
   As an alternative suggestion, I suggest you put unique widgets on
   each state dependent panel.  You'll have to name and access each
   widget with a unique name.  For example "HELP Panel 1" and "HELP
   Panel 2." In this example, I want to have the buttons both labeled 
   "HELP"...not "Help Panel 1" and "Help Panel 2." code excerpts are as
   follows:

   int example_desc ()
   {
      ...
      param1 = AVSadd_parameter("Help Panel 1", "oneshot", 0, 0, 1);
      param1 = AVSadd_parameter_prop (param1, "title", "string",
      "HELP");
      AVSconnect_widget (param1, "oneshot");
      param2 = AVSadd_parameter("Help Panel 2", "oneshot", 0, 0, 1);
      param2 = AVSadd_parameter_prop (param2, "title", "string",
      "HELP");
      AVSconnect_widget (param2, "oneshot");
     ...
   }

   int example_comp (...Help_Panel_1, Help_Panel_2, ...)
   ...
   {
      ...
      if (AVSparameter_changed ("Help Panel 1")) {
	/* Some action...which just so happens to be state dependent
	since the help buttons appear on different panels! :-) */
      } else if (AVSparameter_changed ("Help Panel 2")) {
      ...
      } ...
      ...
   }

   Since the panels describe the state by providing the user with the 
   control widgets (and other widgets) applicable only to that state, 
   state dependent action can be obtained without explicity maintaining
   a state.  We retitle the buttons so that the user does not see that 
   he/she/otherwise is manipulating a parameter named differently than 
   it is titled.

   The drawback to this approach is that you have lots of widgets.  For
   example if you have 5 panels that share 5 commonly titled oneshots, 
   you need to define 25 uniquely named parameters and have 25 if-AVS-
   parameter-changed statements (thank goodness for copy-cut-and-replace
   =:^)

   Brian Hayes

-- 
| Brian Hayes		| "Know you analysis and design methodology, |
| (310) 616-5129	|  its strengths and weaknesses!" -B.S.Hayes |
| hayes@hac2arpa.hac.com| <standard disclaimer here>                 |
Technical Details
Message-ID: <24839@hacgate.SCG.HAC.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!usc!hacgate!valkris!hayes
References: <147125@lll-winken.LLNL.GOV>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!howland.reston.ans.net!usc!hacgate!valkris!hayes
From: hayes@valkris.aero.org (Brian Hayes 74-35 x65129)
Newsgroups: comp.graphics.avs
Subject: Re: Widget control
Message-ID: <24839@hacgate.SCG.HAC.COM>
Date: 22 Jan 93 21:17:40 GMT
References: <147125@lll-winken.LLNL.GOV>
Sender: news@hacgate.SCG.HAC.COM
Organization: Hughes Aircraft Company, EDSG
Lines: 74