Hallo,

with win31 style, the Get[Save|Open]Filename widget for a long
directory path writes the whole sting in the field allocated for
Directories. The Text often extends into the area with the "Open" and
"Cancel" buttoms and doesn't get erased when the directory is changes.

What function is responsible for formatting the string to fit into the
area allocated for the Listbox: DIALOG_DlgDirList or SetDlgItemTextA?

Win31 ( at least with Wabi) cuts of the letters to the right. Appended 
patch substituted parts of the path beginning from the root with ".."
to make the string fit. However I have the filedwidth hardcoded to
work with Get[Save|Open]Filename. Thats obvious wrong.

How to do better?

Bye

Uwe Bonnes                [EMAIL PROTECTED]

Free Software: If you contribute nothing, expect nothing
--
Index: wine/windows/dialog.c
===================================================================
RCS file: /home/wine/wine/windows/dialog.c,v
retrieving revision 1.53
diff -u -r1.53 dialog.c
--- wine/windows/dialog.c       2000/03/28 20:23:08     1.53
+++ wine/windows/dialog.c       2000/04/01 13:12:09
@@ -2191,11 +2198,25 @@
     if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
     {
         char temp[512];
+        char *p;
+        int fieldwidth = 28; /* FIXME: Get real length */
         int drive = DRIVE_GetCurrentDrive();
         strcpy( temp, "A:\\" );
         temp[0] += drive;
         lstrcpynA( temp + 3, DRIVE_GetDosCwd(drive), sizeof(temp)-3 );
         CharLowerA( temp );
+        if (strlen(temp) >fieldwidth)
+          {
+           TRACE("Directory path too long\n");
+           temp[3]='.';
+           temp[4]='.';
+           /* Substitute directories at base with ".."*/
+           p = strchr(temp+strlen(temp)-fieldwidth+5,'\\');
+           if (!p)
+             /* or trunctate last part */
+             p = temp+strlen(temp)-fieldwidth+5;
+           memmove(temp+5,p,fieldwidth-5);
+           }
         /* Can't use PostMessage() here, because the string is on the stack */
         SetDlgItemTextA( hDlg, idStatic, temp );
     }

Reply via email to