[comp.windows.x] Problem with XtTextDisplay

dweber@URBANA.MCD.MOT.COM (Daniel Weber) (09/29/89)

Hardware:  Motorola Delta 1147, with MVME393 graphics card
Software:  SysV68 R3V5.1 (SysV 3.0), running an X11R2 server and X11R3 libs.
	(Also duplicated on a NCD16 X Terminal - X11R3 server.)

Question context:  Athena Text Widgets

The "X Toolkit Athena Widgets" document, which comes with the X11R3 
distribution, states on page 27:

	"The XtDisableRedisplay function causes all changes to be be batched
	until XtTextDisplay or XtTextEnableRedisplay is called."

	.
	.
	.

	"The XtTextDisplay function forces any accumulated updates to be
	displayed."


However, XtTextDisplay does not work as stated in this document.  The text
displayed in the widget is cleared, but no new text is plotted.

>From the documentation, it seems that XtTextDisplay flushes batched text
updates and XtTextEnableRedisplay enables text display (no batching) and
flushes any batched text updates: identical functionality expect for the
setting of a flag.  However, the source seems to indicates that the
functionality between the two is much different.

Is the documentation correct, or the observed functionality/source?  If the 
latter, what is the expected functionality of XtTextDisplay?
---------------------------CUT----------------------------
/*
 *  Example of perceived problem with XtTextDisplay.   With XtTextDisplay
 *  the widget shows up blank.  With XtTextDisplay commented out and
 *  XtTextEnableRedisplay commented in, the text appears correctly.
 */

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/AsciiText.h>
#include <stdio.h>

#define	POS1	0
#define	POS2	18

#define TEXT	"Test line of text.\nSecond line of text."
#define NEW_TEXT	"TEST LINE OF TEXT"

static Arg shell_args[] = {
	{ XtNx,		500 },
	{ XtNy,		480 }
};

static Arg arglist[] = {
	{ XtNstring, 	(XtArgVal) TEXT },
	{ XtNeditType, 	(XtArgVal) XttextEdit},
	{ XtNheight, 	40 },
	{ XtNtextOptions, wordBreak | resizeHeight | resizeWidth},
	{ XtNwidth, 	200}
};

XtAppContext app;

main(argc, argv)
unsigned int argc;
char **argv;
{
    Widget TopLevel;
    Widget MyText;
    XtTextBlock NewText;
    int retval;

    char *index();

    TopLevel = XtInitialize("textTest", "Demo", shell_args,
				XtNumber(shell_args), &argc, argv);

    MyText = XtCreateManagedWidget(argv[0], asciiStringWidgetClass,
			    TopLevel, arglist, XtNumber(arglist) );

    (void) XtRealizeWidget(TopLevel);

    /*
     * test XTextDisplay
     */

    NewText.firstPos = 0;
    NewText.length = strlen(NEW_TEXT);
    NewText.ptr = NEW_TEXT; 
    NewText.format = FMT8BIT;
    /*
     * Disable redisplay, causing text uptdates to be batched
     */
    (void) XtTextDisableRedisplay(MyText);
    if (XtTextReplace(MyText, 0, strlen(NEW_TEXT), &NewText) != XawEditDone)
    {
	printf("XtTextReplace Failed.\n");
    }

    (void) XtTextDisplay(MyText);
    /* (void) XtTextEnableRedisplay(MyText); */

    (void) XtMainLoop();
}
------------------------------------------------------------------------------

Daniel J. Weber				Motorola Microcomputer Division
dweber@urbana.mcd.mot.com			   Urbana Design Center
uunet!uiucuxc!udc!dweber			      +1 217 384 - 8743