Board index » delphi » Shorten long file path with "..."?
Dave
![]() Delphi Developer |
Tue, 14 Oct 2003 01:24:19 GMT
|
Dave
![]() Delphi Developer |
Tue, 14 Oct 2003 01:24:19 GMT
Shorten long file path with "..."?
Hi all,
I thought there was a function to shorten long file paths c:\program files\microsoft office\pictures\jpeg might become: C:\program files\...\jpeg Am I worng? Is there a function in D5 to shorten a file - Dave -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- |
AlanGLLo
![]() Delphi Developer |
Tue, 14 Oct 2003 05:19:24 GMT
Re:Shorten long file path with "..."?In article <3ae859ce$...@news5.newsfeeds.com>, "Dave" <fornals...@mediaone.net> writes: Quote>Am I worng? Is there a function in D5 to shorten a file encapsulated into a function as follows ... function PathEllipsis(Path : string; Control : TWinControl; ... and used as ... with TitleLbl do ... when the file name was in a label on a TPanel. You could use DT_WORD_ELLIPSIS and get truncation with ellipses at the end of Alan Lloyd |
Ryan Style
![]() Delphi Developer |
Tue, 14 Oct 2003 05:47:50 GMT
Re:Shorten long file path with "..."?Or you can use the MinimizeName() function. =P MinimizeName(YOUR PATH HERE, Canvas, Length); Example: In my app, I use: MinimizeName('C:\Program Files\ICQ\ICQ.EXE', That gives me: C:\..\ICQ\ICQ.EXE Only problem with MinimizeName is that it NEEDS a canvas to work with. Ryan On 26 Apr 2001 21:19:24 GMT, alangll...@aol.com (AlanGLLoyd) wrote: Quote>In article <3ae859ce$...@news5.newsfeeds.com>, "Dave" <fornals...@mediaone.net> |
AlanGLLo
![]() Delphi Developer |
Tue, 14 Oct 2003 15:01:19 GMT
Re:Shorten long file path with "..."?In article <sm5het8oaj2favj90k4nbvt6cp96ed7...@4ax.com>, Ryan Styles Quote<ner...@d.cat> writes: Canvas.TextWidth to establish the space taken by the text. My solution asks for a control and I use it's Canvas. MinimizeName (which I did not know of) ellipses at the start of the path, while Alan Lloyd |
Ryan Style
![]() Delphi Developer |
Wed, 15 Oct 2003 06:38:49 GMT
Re:Shorten long file path with "..."?On 27 Apr 2001 07:01:19 GMT, alangll...@aol.com (AlanGLLoyd) wrote: Quote>Not necessarily, any solution must have a Canvas in order to use didn't see any canvas reference. Was in a rush. =P Quote>MinimizeName (which I did not know of) ellipses at the start of the path, while semi-useful! But why do you feel it is a better GUI solution? Cheers! |
AlanGLLo
![]() Delphi Developer |
Wed, 15 Oct 2003 18:04:26 GMT
Re:Shorten long file path with "..."?In article <94tjetk9ts1bnf7t14cepb3rfohvu17...@4ax.com>, Ryan Styles Quote<ner...@d.cat> writes: E:\AProject\LexaCom\My Stuff\Archive\Priority.exe ... I think it would be more useful to me to see ... E:\...\Archive\Priority.exe ... than ... E:\AProject\...\Priority.exe But it may depend on the particular file and application. Alan Lloyd |
Ingol
![]() Delphi Developer |
Thu, 16 Oct 2003 17:29:54 GMT
Re:Shorten long file path with "..."?Thi is a bad solution Quote> E:\AProject\LexaCom\My Stuff\Archive\Priority.exe the last pathname, like tihs : E:\AProject\LexaCom\...\Archive\Priority.exe You have no chance of getting a hint of where the file is located when using Quote> E:\...\Archive\Priority.exe E:\AProject\LexaCom\...\Archive\Priority.exe Gives you a hint of where the file is located 2 subdirs deep, thereby E:\AProject\...\Priority.exe if this is too long.... expand your label ;) -- Quote"AlanGLLoyd" <alangll...@aol.com> wrote in message Quote> In article <94tjetk9ts1bnf7t14cepb3rfohvu17...@4ax.com>, Ryan Styles |
Bj?rge S?the
![]() Delphi Developer |
Fri, 17 Oct 2003 04:05:29 GMT
Re:Shorten long file path with "..."?"Ingolf" <DONT_SPAM_ing...@musling.dk> skrev i melding news:w9RG6.65817$o4.5852960@news010.worldonline.dk... Quote> "AlanGLLoyd" <alangll...@aol.com> wrote in message E:\APr..\Lex..\My ..\Arc..\Priority.exe - the worst thing about shortening paths is that the most common error made - E:\AProject\LexaCom\My Stuff\Archive\LexaCom\My Stuff\Archive\Priority.exe ..then it doesn't help much to see either the first two or the last two -- |
Dave
![]() Delphi Developer |
Sat, 18 Oct 2003 01:12:39 GMT
Re:Shorten long file path with "..."?Quote>>MinimizeName(YOUR PATH HERE, Canvas, Length);<< to do with it? Or it it an API I need to declare? - Dave |