Article View: comp.graphics.avs
Article #126Re: Help: Creating Simple Value Display
From: Larry Gelberg
Date: Thu, 03 Sep 1992 13:31
Date: Thu, 03 Sep 1992 13:31
99 lines
4641 bytes
4641 bytes
hayes%valkris@hac2arpa.hac.com (Brian Hayes 74-35 x65129) writes:
: I want to be able to display a floating point number in a box with a
: corresponding label. For example:
:
: POSITION
: +---------+
: X | 1234.56 |
: +---------+
:
: I understand that first I used the Network Editor followed by the Layout
: Editor. Unfortunately, I can't seem to find an appropriate module for
: displaying a number.
Well, you're mostly right - to do something this specific, you need to
write a more specific module. I have included one here as a guide.
There are a couple of ways to display values. The one I've included
uses a floating point 'typein' widget, but other choices available are:
string and string-block widgets (I've used this for the 'Position' label)
and even generating labels as Geoms and displaying them with the Geom
Viewer. Take a look at this example, good luck, and don't be afraid to
RTFM. Developer's Guide: A10-13
=== Larry Gelberg ============================ larryg@avs.com =======
Advanced Visual Systems Inc. (AVS Inc.)
300 Fifth Ave, Waltham, MA 02154
===== Tel: 617-890-4300 = Fax: 617-890-8287 =========================
/* mod_gen Version 1 */
/* Module Name: "display_number" (Input) (Subroutine) */
/* Author: Larry Gelberg */
/* Date Created: Thu Sep 3 08:49:53 1992 */
/* */
/* This file is automatically generated by the Module Generator (mod_gen)*/
/* Please do not modify or move the contents of this comment block as */
/* mod_gen needs it in order to read module sources back in. */
/* */
/* param 0 "Position" text "Position" "" ":" */
/* param 1 "X" typein_real 1234.56 0.00000 10000.0 */
/* End of Module Description Comments */
#include <stdio.h>
#include <avs/avs.h>
#include <avs/port.h>
/* ----> START OF USER-SUPPLIED CODE SECTION #1 (INCLUDE FILES, GLOBAL VARIABLES)*/
/* <---- END OF USER-SUPPLIED CODE SECTION #1 */
/* *****************************************/
/* Module Description */
/* *****************************************/
int display_number_desc()
{
int in_port, out_port, param;
extern int display_number_compute();
AVSset_module_name("display_number", MODULE_DATA);
/* Parameter Specifications */
param = AVSadd_parameter("Position", "string", "Position", " ", ":");
AVSconnect_widget(param, "text");
param = AVSadd_float_parameter("X", 1234.56, 0.00000, 10000.0);
AVSconnect_widget(param, "typein_real");
AVSset_compute_proc(display_number_compute);
/* ----> START OF USER-SUPPLIED CODE SECTION #2 (ADDITIONAL SPECIFICATION INFO)*/
/* <---- END OF USER-SUPPLIED CODE SECTION #2 */
return(1);
}
/* *****************************************/
/* Module Compute Routine */
/* *****************************************/
int display_number_compute( Position, X)
char *Position;
float *X;
{
/* ----> START OF USER-SUPPLIED CODE SECTION #3 (COMPUTE ROUTINE BODY) */
/* <---- END OF USER-SUPPLIED CODE SECTION #3 */
return(1);
}
/* ***********************************************************************/
/* Initialization for modules contained in this file. */
/* ***********************************************************************/
int ((*mod_list[])()) = {
display_number_desc,
};
#define NMODS (sizeof(mod_list) / sizeof(char *))
AVSinit_modules()
{
AVSinit_from_module_list(mod_list, NMODS);
}
/* ----> START OF USER-SUPPLIED CODE SECTION #4 (SUBROUTINES, FUNCTIONS, UTILITY ROUTINES)*/
/* <---- END OF USER-SUPPLIED CODE SECTION #4 */
Technical Details
Message-ID:
<1992Sep3.133137.16516@ctr.columbia.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!phobos!larrygReferences:
<23131@hacgate.SCG.HAC.COM>Show Full Headers
Complete Article Headers
Newsgroups: comp.graphics.avs Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!phobos!larryg From: larryg@avs.com (Larry Gelberg) Subject: Re: Help: Creating Simple Value Display Organization: Advanced Visual Systems Inc. References: <23131@hacgate.SCG.HAC.COM> Message-ID: <1992Sep3.133137.16516@ctr.columbia.edu> Sender: news@ctr.columbia.edu (The Daily Lose) X-Newsreader: Tin 1.1 PL4 Date: Thu, 3 Sep 1992 13:31:37 GMT X-Posted-From: phobos.avs.com X-Posted-Through: sol.ctr.columbia.edu Lines: 99