>From: goldberg@sccsi.com (Steve Goldberg)
>Date: 5 Mar 1995 03:44:32 GMT
>Organization: Landata RE-Source
>Subject: [NEWS] Input attributes made variable
>Can the input atributes (reverse, color, etc) be set at run time based
>upon the value of the env var TERM? Depending upon the type of termimal
>used, sometimes I want reversed, sometimes a color. Is there a way to do
>this besides putting every input and display statement within an if or
>case statement?
>e.g. define atrib_type char(20)
> let atrib_type = ......
> input array ..... attribute (atrib_type)
>Steve Goldberg
>Landata RE-Source
>Houston
Hi
There are undocumented C variables _optds_attr and _optin_attr. They must
be defined as 'extern int'.
I send a couple of functions to get and to set this values.
------------------------ Cut there --------------------------------------
extern int _optin_attr;
extern int _optds_attr;
int get_attr(narg)
int narg;
{
if (narg != 0)
fgl_fatal( __FILE__, __LINE__, -1318 );
retint( _optds_attr );
retint( _optin_attr );
return( 2 );
}
int set_attr(narg)
int narg;
{
int inp_attr;
int dsp_attr;
if (narg != 2)
fgl_fatal( __FILE__, __LINE__, -1318 );
popint(&inp_attr);
popint(&dsp_attr);
_optin_attr = inp_attr;
_optds_attr = dsp_attr;
return (0);
}
------------------------ End --------------------------------------------
and, corresponding attributes values :
WHITE,NORMAL 0
YELLOW 256
MAGENTA 512
RED,BOLD 768
CYAN 1024
GREEN 1280
BLUE,DIM 1536
BLACK 1792
REVERSE 2048
BLINK 4096
UNDERLINE 8192
FORM 3584
WINDOW 3840
INVISIBLE 65536
If you don't set DISPLAY ATTRIBUTE(...) or INPUT ATTRIBUTE(...) before 1-st
call of get_attr(), it will return (-1),(-1).
I use SCO UNIX and I-4GL C-version v.4.10.
I hope this helps.
Ed.