I think this (from comp.windows.x.motif) can be seen as an enhancement
request.

        Danny

> [EMAIL PROTECTED] (Carlos A M dos Santos) wrote in message 
>news:<[EMAIL PROTECTED]>...
> 
> >         file = fopen(filename, "r");
> >         contents = XtMalloc(length + 1);
> >         fread(contents, sizeof(char), length, file);
> >         contents[length] = '\0';
> >         XmTextSetString(text, contents);
> >         XtFree(contents);
> >         fclose(file);
> 
> By the way, it would be nice if something like XmTextLoadFile(...) existed,
> allowing us to avoid to XtMalloc() the entire buffer. That would possibly
> require writing a function tu build a XmTextSource from a file contents.
> 
> --- Casantos

Earlier article :
> XmText with file as input ?
> From: Roland Mainz <[EMAIL PROTECTED]>
> Date: Sunday 03 November 2002 01:36:01
> Groups: comp.windows.x,comp.windows.x.motif
> 
> Hi!
> 
> ----
> 
> Is it somehow possible to use a file as input for a XmText widget ?
> 
> Athena's asciiTextWidgetClass supports this without problems (see
> example below) - but what about XmText ?
> 
> -- snip --
> #include <X11/StringDefs.h> 
> #include <X11/Intrinsic.h> 
> #include <X11/Xaw/Form.h> 
> #include <X11/Xaw/AsciiText.h> 
> 
> #include <stdlib.h>
> #include <stdio.h>
> 
> int main( int argc, char *argv[] )
> {
>   XtAppContext app;
>   Widget       toplevel;
>   Widget       form;
>   Widget       text;
>   int          n;
>   Arg          args[8];
> 
>   toplevel = XtAppInitialize(&app, "XMore", NULL, 0, &argc, argv, NULL,
> NULL, 0);
> 
>   if (argc != 2)
>   {
>     printf("usage: %s [ x options ] filename\n", argv[0]);
>     exit(EXIT_FAILURE);
>   }
> 
>   form = XtCreateManagedWidget("form", formWidgetClass, toplevel, NULL,
> 0);
> 
>   n = 0;
>   XtSetArg(args[n], XtNtype,             XawAsciiFile);            n++;
>   XtSetArg(args[n], XtNstring,           argv[1]);                 n++;
>   XtSetArg(args[n], XtNwidth,            500);                     n++;
>   XtSetArg(args[n], XtNheight,           600);                     n++;
>   XtSetArg(args[n], XtNscrollHorizontal, XawtextScrollWhenNeeded); n++;
>   XtSetArg(args[n], XtNscrollVertical,   XawtextScrollAlways);     n++;
> 
>   text = XtCreateManagedWidget("text", asciiTextWidgetClass, form, args,
> n);
> 
>   XtRealizeWidget(toplevel);
>   
>   XtAppMainLoop(app);
> 
>   return EXIT_SUCCESS;
> }
> -- snip --
> 
> ----
> 
> Bye,
> Roland
> 
> ��__�.��.�__ (o.\ \/ /.o) [EMAIL PROTECTED]
>   \__\/\/__/  [EMAIL PROTECTED]
>   /O /==\ O\  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
>  (;O/ \/ \O;) TEL +49 641 99-41370 FAX +49 641 99-41359

-- 
Danny Backx ([EMAIL PROTECTED] [EMAIL PROTECTED])
Home page :     http://users.skynet.be/danny.backx
Projects:       LessTif (http://lesstif.sourceforge.net)
                Xbae    (http://xbae.sourceforge.net)
_______________________________________________
Lesstif mailing list
[EMAIL PROTECTED]
https://terror.hungry.com/mailman/listinfo/lesstif

Reply via email to