* Paul Boersma <[EMAIL PROTECTED]> [2007-01-23 13:02]:

> thank you for wanting to look into the code again. The code that 
> creates the widgets is in the routine praat_init in the file 
> sys/praat.c

Thanks.  I took a quick look and I think I found a way to get around the
"bug".  I am attaching below a patch that works in Debian with Lesstif.  A
caveat: this is the first time I ever touched a program in Motif/Lesstif.  I
have just learned enough from the man pages in the past 45 minutes.

This patch essentially transforms listWindow into a Form and
praat_objectlist into a ScrolledList.  According to the Motif FAQ [1], it is
better to use XmCreateScrolledList instead of creating a List widget
inside a ScrolledWindow.

Besides fixing the "bug" for me, this change has a nice side effect, namely
that when the one of the names in praat_objectlist is too wide, a horizontal
scroll bar appears.  This does not happen for the released version of Praat
in Debian.

I am attaching below two screenshots showing the main Praat window before
and after resizing.

Best,

-- 
Rafael

[1] http://www.rahul.net/kenton/faqs/Motif-FAQ.html#109
--- praat-4.5.8.orig/sys/praat.c
+++ praat-4.5.8/sys/praat.c
@@ -1052,6 +1052,7 @@
                Widget Raam = NULL;
 #ifndef _WIN32
                Widget listWindow;
+               Widget listParent;
 #endif
                #ifdef macintosh
                MelderMotif_create (praat.context, praat.topShell);   /* BUG: 
default Melder_assert would call printf recursively!!! */
@@ -1074,10 +1075,10 @@
                praatList_objects = XmCreateList (Raam, "list", NULL, 0);
                XtVaSetValues (praatList_objects,
                        XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 26,
-                       XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 
100,
+                       XmNbottomAttachment, XmATTACH_FORM, XmNbottomOffset, 10,
                        XmNx, -1, XmNwidth, LIST_WIDTH, NULL);
 #else
-               listWindow = XmCreateScrolledWindow (Raam, "listWindow", NULL, 
0);
+               listWindow = XmCreateForm (Raam, "listWindow", NULL, 0);
                #ifdef macintosh
                        XtVaSetValues (listWindow,
                                XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 
Machine_getMainWindowMenuBarHeight () + 26,
@@ -1089,7 +1090,14 @@
                                XmNbottomAttachment, XmATTACH_FORM, 
XmNbottomOffset, 80,
                                XmNwidth, LIST_WIDTH, NULL);
                #endif
-               praatList_objects = XmCreateList (listWindow, "list", NULL, 0);
+               praatList_objects = XmCreateScrolledList (listWindow, "list", 
NULL, 0);
+               listParent = XtParent (praatList_objects);
+               XtVaSetValues (listParent, XmNvisualPolicy, XmVARIABLE,
+                               XmNtopAttachment, XmATTACH_FORM, XmNtopOffset, 
0,
+                               XmNbottomAttachment, XmATTACH_FORM, 
XmNbottomOffset, 0,
+                               XmNwidth, LIST_WIDTH, NULL);
+         
+
 #endif
                XtAddCallback (praatList_objects, XmNextendedSelectionCallback, 
cb_list, 0);
                XtManageChild (praatList_objects);

Attachment: praat-main-before-resize.png
Description: PNG image

Attachment: praat-main-after-resize.png
Description: PNG image

Reply via email to