[comp.windows.x.motif] YATWB.

Uucp@resq.fidonet.org (Uucp) (03/26/91)

From  uunet!osf.org!motif-talk-request
From: uunet!logm.se!beaver (Per Beremark)
To:   motif-talk@osf.org
Date: Mon, 25 Mar 91 14:31:03 +0100




                          OSF Problem Report
                  =================================


Submitter Information 
---------------------

Submitter Name:         Per Beremark
Organization:           Telesoft Europe AB
Email Address:          beaver@logm.se
Phone:                  46-040-254713
OSF License Number:     Hummm?


Hardware/Software Configuration
-------------------------------

Offering and Version:   Motif 1.1.1
Component (Module):     Text.c, TextIn.c, TextOut.c ?
Client Hardware:        Sun Sparcstation IPC, HP 9000/300-400 
Client Software:        SunOS-4.0.3 X11R4.18, HPUX 7.0
Server Hardware:        Sun Sparcstation IPC, HP 9000/300-400 
Server Software:        SunOS 4.0.3 X11R4.18, HPUX 7.0
Compiler:               gcc-1.37

Problem Description
-------------------

Severity Level:         Critical -- represents a problem which
                        resulted in software malfunctio n or a feature
                        failure and has no work-around. 


Date of First Occurrence: 910325

One Line Description:

        XmTextReplace followed by XmTextShowPosition, screws up
        the Textbuffer showed in a scrolled window.


Full Description:

        Run the appended example, by scrolling down, and clicking
        anywhere in the text area.
        After clicking you can't scroll to the beginning of the text.
        You can scroll below the last line in the text.
        You also get a Toolkit Warning about the scrollbar.

Repeat By:

        Run the appended example.

Proposed Solution:

        No solution, but the following workwround helped us:

        In TextOut.c: 

                In function ChangeVSB, change the following lines. 

-      if (widget->text.last_top_char < widget->text.top_character)
-         widget->text.top_line += CountLines(widget, widget->text.last_top_char,
-                                             widget->text.top_character);
-      else
-         widget->text.top_line -= CountLines(widget, widget->text.top_character,
-                                             widget->text.last_top_char);


                To.

+         widget->text.top_line = CountLines(widget, 0, widget->text.top_character);    



*********************** EXAMPLE **************************

#include <X11/Intrinsic.h>
#include <X11/Core.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/Text.h>
#include <Xm/DialogS.h>
#include <Xm/BulletinB.h>

static   Widget     appShell;
static   char *helpText =
"TOP------ --------- --------- --------- ---------\n\
1 77777777777777777777777777777777777777777777777\n\
2 77777777777777777777777777777777777777777777777\n\
3 77777777777777777777777777777777777777777777777\n\
4 77777777777777777777777777777777777777777777777\n\
5 77777777777777777777777777777777777777777777777\n\
6 77777777777777777777777777777777777777777777777\n\
7 77777777777777777777777777777777777777777777777\n\
8 77777777777777777777777777777777777777777777777\n\
9 77777777777777777777777777777777777777777777777\n\
10 7777777777777777777777777777777777777777777777\n\
11 7777777777777777777777777777777777777777777777\n\
12 7777777777777777777777777777777777777777777777\n\
13 7777777777777777777777777777777777777777777777\n\
14 7777777777777777777777777777777777777777777777\n\
15 7777777777777777777777777777777777777777777777\n\
16 7777777777777777777777777777777777777777777777\n\
17 7777777777777777777777777777777777777777777777\n\
18 7777777777777777777777777777777777777777777777\n\
19 7777777777777777777777777777777777777777777777\n\
20 7777777777777777777777777777777777777777777777\n\
21 7777777777777777777777777777777777777777777777\n\
22 7777777777777777777777777777777777777777777777\n\
23 7777777777777777777777777777777777777777777777\n\
24 7777777777777777777777777777777777777777777777\n\
25 7777777777777777777777777777777777777777777777\n\
26 7777777777777777777777777777777777777777777777\n\
27 7777777777777777777777777777777777777777777777\n\
28 7777777777777777777777777777777777777777777777\n\
29 7777777777777777777777777777777777777777777777\n\
30 7777777777777777777777777777777777777777777777\n\
31 7777777777777777777777777777777777777777777777\n\
32 7777777777777777777777777777777777777777777777\n\
33 7777777777777777777777777777777777777777777777\n\
34 7777777777777777777777777777777777777777777777\n\
35 7777777777777777777777777777777777777777777777\n\
36 7777777777777777777777777777777777777777777777\n\
37 7777777777777777777777777777777777777777777777\n\
38 7777777777777777777777777777777777777777777777\n\
39 7777777777777777777777777777777777777777777777\n\
40 7777777777777777777777777777777777777777777777\n\
41 7777777777777777777777777777777777777777777777\n\
42 7777777777777777777777777777777777777777777777\n\
43 7777777777777777777777777777777777777777777777\n\
44 7777777777777777777777777777777777777777777777\n\
45 7777777777777777777777777777777777777777777777\n\
46 7777777777777777777777777777777777777777777777\n\
47 7777777777777777777777777777777777777777777777\n\
48 7777777777777777777777777777777777777777777777\n\
49 7777777777777777777777777777777777777777777777\n\
50 7777777777777777777777777777777777777777777777\n\
51 7777777777777777777777777777777777777777777777\n\
52 7777777777777777777777777777777777777777777777\n\
53 7777777777777777777777777777777777777777777777\n\
54 7777777777777777777777777777777777777777777777\n\
55 7777777777777777777777777777777777777777777777\n\
56 7777777777777777777777777777777777777777777777\n\
57 7777777777777777777777777777777777777777777777\n\
58 7777777777777777777777777777777777777777777777\n\
59 7777777777777777777777777777777777777777777777\n\
60 7777777777777777777777777777777777777777777777\n\
61 7777777777777777777777777777777777777777777777\n\
62 7777777777777777777777777777777777777777777777\n\
63 7777777777777777777777777777777777777777777777\n\
64 7777777777777777777777777777777777777777777777\n\
65 7777777777777777777777777777777777777777777777\n\
66 7777777777777777777777777777777777777777777777\n\
67 7777777777777777777777777777777777777777777777\n\
68 7777777777777777777777777777777777777777777777\n\
69 7777777777777777777777777777777777777777777777\n\
70 7777777777777777777777777777777777777777777777\n\
71 7777777777777777777777777777777777777777777777\n\
72 7777777777777777777777777777777777777777777777\n\
73 7777777777777777777777777777777777777777777777\n\
74 7777777777777777777777777777777777777777777777\n\
75 7777777777777777777777777777777777777777777777\n\
76 7777777777777777777777777777777777777777777777\n\
77 7777777777777777777777777777777777777777777777\n\
78 7777777777777777777777777777777777777777777777\n\
79 7777777777777777777777777777777777777777777777\n\
80 7777777777777777777777777777777777777777777777\n\
81 7777777777777777777777777777777777777777777777\n\
82 7777777777777777777777777777777777777777777777\n\
83 7777777777777777777777777777777777777777777777\n\
84 7777777777777777777777777777777777777777777777\n\
85 7777777777777777777777777777777777777777777777\n\
86 7777777777777777777777777777777777777777777777\n\
87 7777777777777777777777777777777777777777777777\n\
88 7777777777777777777777777777777777777777777777\n\
89 7777777777777777777777777777777777777777777777\n\
90 7777777777777777777777777777777777777777777777\n\
91 7777777777777777777777777777777777777777777777\n\
92 7777777777777777777777777777777777777777777777\n\
93 7777777777777777777777777777777777777777777777\n\
94 7777777777777777777777777777777777777777777777\n\
95 7777777777777777777777777777777777777777777777\n\
96 7777777777777777777777777777777777777777777777\n\
97 7777777777777777777777777777777777777777777777\n\
98 7777777777777777777777777777777777777777777777\n\
99 7777777777777777777777777777777777777777777777\n\
100 777777777777777777777777777777777777777777777\n\
BOTTOM--- --------- --------- --------- --------- \n";

/******************************************************************/
static void cursorMotionCB( Widget w, XmTextVerifyPtr closure, 
                            XtPointer data)
{
   XmTextReplace( w, 50, 50, 
"1 77777777777777777777777777777777777777777777777\n\
2 77777777777777777777777777777777777777777777777\n\
3 77777777777777777777777777777777777777777777777\n\
4 77777777777777777777777777777777777777777777777\n\
5 77777777777777777777777777777777777777777777777\n\
6 77777777777777777777777777777777777777777777777\n\
7 77777777777777777777777777777777777777777777777\n\
8 77777777777777777777777777777777777777777777777\n\
9 77777777777777777777777777777777777777777777777\n\
10 7777777777777777777777777777777777777777777777\n"
);
   XmTextShowPosition( w, 200);
}

static Widget CreatetextWindow(Widget parent)

{
    Arg      arg[10];
    Cardinal nrOfArgs;
    Widget   dialogText;

    nrOfArgs = 0;
    /* Place cursor at the end of text */
    XtSetArg(arg[nrOfArgs], XmNcursorPosition,  strlen(helpText));
    nrOfArgs++;
    XtSetArg(arg[nrOfArgs], XmNcolumns, 60);
    nrOfArgs++;
    XtSetArg(arg[nrOfArgs], XmNrows, 40);
    nrOfArgs++;
    XtSetArg(arg[nrOfArgs], XmNeditMode, XmMULTI_LINE_EDIT);
    nrOfArgs++;
    XtSetArg(arg[nrOfArgs], XmNvalue, helpText);
    nrOfArgs++;
    /* OK now lets create it */
    dialogText = XmCreateScrolledText(parent, "InputField",
                            arg, nrOfArgs);
    
    XtAddCallback( dialogText, XmNmotionVerifyCallback, cursorMotionCB, NULL);
    return(dialogText);
} /* CreatetextWindow */

void CreateApplication ( Widget parent )
{
   Widget       buletinB,
                textW;
   buletinB = XmCreateBulletinBoardDialog( parent, "BulletinBoard", 
                 NULL, 0);

   textW = CreatetextWindow(buletinB);
   XtManageChild( textW);
   
   XtManageChild(buletinB);
}


void main (unsigned int argc, char **argv)
{
   appShell = XtInitialize("SDT2 - Graphics Main Window",
                           "SDT2", NULL,
                           0, /* XtNumber(options), */
                           &argc, argv);

   CreateApplication (appShell);

   XtMainLoop ();
}
--  
Uucp - via FidoNet node 1:269/133
UUCP: uunet!resq!Uucp