ScrolledText in an XmNotebook issues scrollbar warnings
When an XmNotebook page is a ScrolledText, if the window is grown
horizontally when the scrollbar slider touches the maximum extent, the
scroll bar issues a warning message "The specified scrollbar value is
greater than the maximum scrollbar value minus the scrollbar slider
size." The vertical scroll bar works properly and does not issue such
a warning.
To demonstrate, compile this code and execute. Move the horizontal
scrollbar completely to the right, then grow the window horizontally.
I found this behavior to exist in Motif2.1, 2.2, and 2.3 on all
platforms I tried.
#include <Xm/Xm.h>
#include <Xm/MainW.h>
#include <Xm/PushB.h>
#include <Xm/Text.h>
#include <Xm/Form.h>
#include <Xm/Notebook.h>
int main( Cardinal argc, char **argv) {
Widget wTabManager;
Widget wTab;
Widget wPage;
Widget wTopLevel;
Widget wForm;
Widget wText;
XtAppContext appContext;
Arg Args[10];
int n;
char *value = "This is the a test of the scrolled text\n\
inside a form that is a tab page\n\n\n\n\n\n\n\n\n\n\n";
XtSetLanguageProc (NULL, NULL, NULL);
wTopLevel = XtVaAppInitialize(&appContext, "menubarExample", NULL,
0,
&argc, argv, NULL, NULL);
wTabManager = XtVaCreateManagedWidget( "tabmgr",
xmNotebookWidgetClass,
wTopLevel,
NULL);
wTab = XtVaCreateManagedWidget( "tab",
xmPushButtonWidgetClass, wTabManager,
XmNnotebookChildType, XmMAJOR_TAB,
XmNpageNumber, 1,
NULL ) ;
wPage = XtVaCreateManagedWidget( "page",
xmFormWidgetClass, wTabManager,
XmNwidth, 100,
XmNheight, 200,
XmNnotebookChildType, XmPAGE,
XmNpageNumber, 1,
NULL ) ;
n = 0;
XtSetArg( Args[n], XmNeditable, False ); n++;
XtSetArg( Args[n], XmNeditMode, XmMULTI_LINE_EDIT ); n++;
XtSetArg( Args[n], XmNleftAttachment, XmATTACH_FORM ); n++;
XtSetArg( Args[n], XmNrightAttachment, XmATTACH_FORM ); n++;
XtSetArg( Args[n], XmNtopAttachment, XmATTACH_FORM ); n++;
XtSetArg( Args[n], XmNbottomAttachment, XmATTACH_FORM ); n++;
XtSetArg( Args[n], XmNvalue, value ); n++;
wText = XmCreateScrolledText(wPage, "text", Args, n);
XtManageChild(wText);
XtRealizeWidget(wTopLevel);
XtAppMainLoop(appContext);
return 0;
}
Any way to fix this short of registering a custom warning message
handler that will ignore this particular message?
--
Fred L. Kleinschmidt
Boeing Technical Fellow
Aerodynamics Stability and Control
Re: ScrolledText in an XmNotebook issues scrollbar warnings
[email]fred.l.kleinschmidt@boeing.com[/email] wrote:[color=blue]
> When an XmNotebook page is a ScrolledText, if the window is grown
> horizontally when the scrollbar slider touches the maximum extent, the
> scroll bar issues a warning message "The specified scrollbar value is
> greater than the maximum scrollbar value minus the scrollbar slider
> size." The vertical scroll bar works properly and does not issue such
> a warning.[/color]
I have tried your code and can reproduce your bug on OpenMotif 2.3,
even with the latest CVS version.
I found out that bug is not related to XmNotebook.
It is a genuine XmText bug.
A quick and dirty non-fix is to change your requirements
and drop the horizontal scrollbar:
....[color=blue]
> XtSetArg( Args[n], XmNbottomAttachment, XmATTACH_FORM ); n++;[/color]
XtSetArg( Args[n], XmNscrollbarHorizontal, FALSE ); n++
XtSetArg( Args[n], XmNwordWrap, TRUE ); n++[color=blue]
> XtSetArg( Args[n], XmNvalue, value ); n++;[/color]
....
If you want to fix it properly, then file a bug report
[url]http://bugs.motifzone.net/[/url]
and also check the OpenMotif source and provide a fix
for the flawed logic in resize calculations of XmText.
Some bugs in OM do get fixed, if you are lucky,
your fix could be included in upcoming OpenMotif 2.3.1
Sorry, I do not know how to fix the toolkit bug
by just modifying the application (other than with
custom warning handler which you mention).
Best regards,
Dušan Peterc
[url]http://www.arahne.si[/url]
Re: ScrolledText in an XmNotebook issues scrollbar warnings
On Dec 8, 3:44 pm, arahne <ara...@arahne.si> wrote:[color=blue]
> fred.l.kleinschm...@boeing.com wrote:[color=green]
> > When an XmNotebook page is a ScrolledText, if the window is grown
> > horizontally when the scrollbar slider touches the maximum extent, the
> > scroll bar issues a warning message "The specified scrollbar value is
> > greater than the maximum scrollbar value minus the scrollbar slider
> > size." The vertical scroll bar works properly and does not issue such
> > a warning.[/color]
>
> I have tried your code and can reproduce your bug on OpenMotif 2.3,
> even with the latest CVS version.
>
> I found out that bug is not related to XmNotebook.
> It is a genuine XmText bug.
>
> A quick and dirty non-fix is to change your requirements
> and drop the horizontal scrollbar:
>
> ...> XtSetArg( Args[n], XmNbottomAttachment, XmATTACH_FORM ); n++;
>
> XtSetArg( Args[n], XmNscrollbarHorizontal, FALSE ); n++
> XtSetArg( Args[n], XmNwordWrap, TRUE ); n++> XtSetArg( Args[n], XmNvalue, value ); n++;
>
> ...
>
> If you want to fix it properly, then file a bug reporthttp://bugs.motifzone.net/
> and also check the OpenMotif source and provide a fix
> for the flawed logic in resize calculations of XmText.
>
> Some bugs in OM do get fixed, if you are lucky,
> your fix could be included in upcoming OpenMotif 2.3.1
>
> Sorry, I do not know how to fix the toolkit bug
> by just modifying the application (other than with
> custom warning handler which you mention).
>
> Best regards,
>
> Dušan Peterchttp://www.arahne.si[/color]
It is now registered vis Bugzilla as Bug#1396