IonicWind Software

IWBasic => General Questions => Topic started by: LarryMc on March 01, 2010, 10:00:23 PM

Title: Ellipsis
Post by: LarryMc on March 01, 2010, 10:00:23 PM
Is there any way to format a string to get the same effect that you get when you DrawText using DT_PATH_ELLIPSIS flag.
Like this:
print temp$=magicsub("c:\\EBDev\\2010\\Feb\\Projects\\GUI\\sample3.eba")
end

sub magicsub(string a$),string
string b$=a$
   ....
   smoke and mirrors
  len(b$) <= predefined_length
   ..... 
return b$
which results in this being printed
Quotec:\EBDev\...\sample3.eba

LarryMc
Title: Re: Ellipsis
Post by: billhsln on March 01, 2010, 10:56:45 PM
Would this be close to what you are looking for?

string temp$
openconsole
temp$ = magicsub("c:\\EBDev\\2010\\Feb\\Projects\\GUI\\sample3.eba")
print temp$
input temp$
closeconsole
end

sub magicsub(string a$), string
string b$
int i,s1 = 0,s2 = 0
for i=4 to len(a$)
if mid$(a$,i,1) = "\\"
if s1 = 0 then s1 = i
s2 = i
endif
next i
b$ = mid$(a$,1,s1) + "..." + mid$(a$,s2)
return b$
endsub


It might not be 100%, but it kind of does what you are looking for as a result.

Bill
Title: Re: Ellipsis
Post by: SnarlingSheep on March 02, 2010, 07:42:06 AM
I think you want the PathCompactPath Function:
http://msdn.microsoft.com/en-us/library/bb773575%28VS.85%29.aspx (http://msdn.microsoft.com/en-us/library/bb773575%28VS.85%29.aspx)
Title: Re: Ellipsis
Post by: LarryMc on March 02, 2010, 07:58:23 AM
Quote from: SnarlingSheep on March 02, 2010, 07:42:06 AM
I think you want the PathCompactPath Function:

That's EXACTLY what I wanted.  Thanks!

Bill:
Thanks for your response as well.  I could have 'made do' with a variation of your suggestion but this is exactly what I was looking for.

LarryMc