October 31, 2025, 11:40:42 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Ellipsis

Started by LarryMc, March 01, 2010, 10:00:23 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

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
When all else fails, get a bigger hammer.

SnarlingSheep


LarryMc

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
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library