[comp.os.vms] Scrolling using SMGs

m1b@rayssd.ray.com (M. Joseph Barone) (06/13/88)

Can anyone help me with reverse scrolling using SMG routines?  The problem
that I am having is that once a portion of text scrolls off the screen,
reverse scrolling does not restore the text -- I just get blank lines.
I am including pertinent portions of my code.  I am using VAXC V2.3 on
VMS V4.7.  Thanks.

/***************************** CUT HERE ********************************/
#include descrip
#include stdio
#include ssdef
#include smgdef

#define	MAXLEN	0xff

main()

{
	FILE	*fpi;				/* SYSMSG.ANC pointer	*/
	int	display;
	int	status, i;
	unsigned	pid;			/* pasteboard IDs	*/
	unsigned	_erase;			/* erase flag		*/
	unsigned	direction = SMG$M_DOWN;	/* scrolling direction	*/
	static int	row, col, lines;
	static int	height, width;
	char	text[MAXLEN];
	$DESCRIPTOR(TEXT, text);
				/* create scrolling region pasteboard	*/
	status = smg$create_pasteboard(&pid, 0, &height, &width, 0);
	if ((status & 1) != SS$_NORMAL) exit(status);

	fpi = fopen("SYS$SCRATCH:TEST.C", "r");	/* open test file	*/
	lines = 1;
	while(fgets(text, MAXLEN - 1, fpi) != NULL)
		lines++;
	fseek(fpi, 0, 0);				/* rewind file	*/

	status = smg$create_virtual_display(&lines, &width, &display, 0, 0, 0);
	if ((status & 1) != SS$_NORMAL) exit(status);

	_erase = TRUE;
	row = 1; col = 1;
	while (fgets(text, MAXLEN - 1, fpi) != NULL) {
		TEXT.dsc$w_length = strlen(text);
		status = smg$put_chars(&display, &TEXT, &row, &col,
			&_erase, 0, 0, 0);
		if ((status & 1) != SS$_NORMAL) exit(status);
		row++;
	}
	row = 1; col = 1;
	status = smg$paste_virtual_display(&display, &pid, &row, &col);
	if ((status & 1) != SS$_NORMAL) exit(status);
	row = 10;
	status = smg$scroll_display_area(&display, 0, 0, 0, 0, 0, &row);
	if ((status & 1) != SS$_NORMAL) exit(status);
	status = smg$scroll_display_area(&display, 0, 0, 0, 0, &direction,
		&row);
	for (i = 0; i < 15; i++)
		status = smg$scroll_display_area(&display, 0, 0, 0, 0, 0, 0);
	for (i = 0; i < 10; i++) {
		status = smg$scroll_display_area(&display, 0, 0, 0, 0, 
			&direction, 0);
	}
}
-- 
Joe Barone ---------------------------> m1b@rayssd.RAY.COM
{cbosgd, gatech, ihnp4, linus, mirror, uiucdcs}!rayssd!m1b
Always wit' da negative waves, Moriarty!  Always wit' da negative waves!