home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / pascal / 7434 < prev    next >
Encoding:
Text File  |  1992-12-13  |  1.8 KB  |  57 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!gabriel
  3. From: gabriel@netcom.com (Gabriel Beccar-Varela)
  4. Subject: Bug in TFileDialog (TP 2.0)
  5. Message-ID: <1992Dec14.005316.28890@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. Date: Mon, 14 Dec 1992 00:53:16 GMT
  8. Lines: 47
  9.  
  10.    Maybe someone already reported this bug, but I'll report it
  11. anyway. The TFileDialog does not work properly with TP 2.0 (it
  12. worked OK with TP 1.0). This is what happens: assuming that the
  13. current directory is C:\UTILS and DATA is a subdirectory under it,
  14. you can have the following situation:
  15.  
  16.    1. Initial list of files:
  17.  
  18.       ANYTHING.EXE
  19.       ANYTHING.OVR
  20.       DATA\
  21.       ..\
  22.  
  23.    2. You select DATA\ and you get the following list:
  24.  
  25.       BIG.DOC
  26.       SMALL.DOC
  27.       MEDIUM.DOC
  28.       ..\
  29.  
  30.    3. You select BIG.DOC and the box closes. If you grab the selected
  31.       file name using GetFileName(Filename) you will see that the full
  32.       name is C:\UTILS\BIG.DOC (rather than C:\UTILS\DATA\BIG.DOC).
  33.  
  34.    After snooping around for a while, I discovered that the function
  35. RelativePath has a logical error in it. The code for that function in
  36. TP 1.0 is
  37.  
  38. begin
  39.   S := LTrim(RTrim(S));
  40.   if (S <> '') and ((S[1] = '\') or (S[2] = ':')) then
  41.      RelativePath := False
  42.   else RelativePath := True;
  43. end;
  44.  
  45. whereas in TP 2.0 is
  46.  
  47. begin
  48.   S := LTrim(RTrim(S));
  49.   RelativePath := not (S <> '') and ((S[1] = '\') or (S[2] = ':'));
  50. end;
  51.  
  52.    The TP 2.0 will always return FALSE because "not S <> '' " is the
  53. same as "S = '' " and an empty string cannot have '\' as its first
  54. character. What is missing is a set of parentesis enclosing the entire
  55. statement after the "not". I simply copied the TP 1.0 code and
  56. TFileDialog worked fine.
  57.