[comp.windows.x] HP TextEdit widget question

mag@genrad.com (Michael Gray) (03/23/89)

This is a relatively simple question.

I am using the Hp widgets and Xt intrinsics shipped with X11R3. 

I am creating a ScrolledWindow widget and placing a text edit widget
inside it (as the only child).  

The textedit widget has the following resources set:

	XtNwrap to XwSoftWrap
	XtNscroll to XwAutoScrollVertical.


When the textedit widget is not inside the scrolled window, every
things works fine.  However, when it is a child of the scrolled window
it doesn't scroll at all (no big suprise I suppose).  

What I would like to know, is there a method that would allow the scrollbars 
of the scrolled window to be updated as the user moves around in the text.  
Conversely, is there a way that the scrollbars can affect the text widget.

I assume that I could probably solve this problem with a series of callbacks,
I was hoping that there would be some way that it could be handled 
automagically.


Thanks in advance,

Michael Gray
GenRad Inc.
Concord, MA.
mag@genrad.com

JAlred.ElSegundo@XEROX.COM (09/01/89)

   I am having a hard time getting a file up in a HP TextEdit widget.  When
the XtNsourceType is XwstringSrc, things work fine; but when XtNsourceType
is XwdiskSrc, I crash and burn in XtCreateManagedWidget for the TextEdit
widget.  
   Any help I could get on this would be greatly appreciated...
   
   Jim Alred <JAlred.ElSegundo@Xerox.COM>
   
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <Xw/Xw.h>
#include <Xw/TextEdit.h>

struct WindowData {
  Widget topLevel;
  Widget fileSW;
  } windowData;

char logFile[100] = "/tmp/junk";

static Arg topLevelArg[] = {
  {XtNallowShellResize, (XtArgVal)True},
  };

static Arg fileSWArg[] = {
  {XtNwidth, (XtArgVal)300},
  {XtNheight, (XtArgVal)250},
  {XtNfile, (XtArgVal)logFile},
/*  {XtNsourceType, (XtArgVal)XwstringSrc}, */
  {XtNsourceType, (XtArgVal)XwdiskSrc},
  };

main(argc, argv)
int argc;
char **argv;
{
  windowData.topLevel = XtInitialize("top", "Top", NULL, 0, &argc, argv);
  XtSetValues(windowData.topLevel, topLevelArg, XtNumber(topLevelArg));

  windowData.fileSW = XtCreateManagedWidget("fileSW",
XwtexteditWidgetClass,
    windowData.topLevel, fileSWArg, XtNumber(fileSWArg));

  XtRealizeWidget(windowData.topLevel);
  XtMainLoop();
}