Lasso Soft Inc. > Home

[string_truncate_fade]

Linkstring_truncate_fade
AuthorJohan Solve
CategoryString
Version8.x
LicensePublic Domain
Posted24 Jun 2009
Updated24 Jun 2009
More by this author...

Description

Fades out a string if it is too long, just as the address bar in Safari 4. Works best for black text on a white background, adjust the colors to use it on other backgrounds.

Sample Usage

string_truncate_fade('Too long string that needs to be truncated in a smooth way', 54);

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag('string_truncate_fade', 
	-required='string', -type='string', 
	-required='length', -type='integer',
	-encodenone);
	#string -> size <= #length ? return(#string);
	local('output'=#string -> substring(1,#length),
		'pos'=integer,
		'colors'=array('#666', '#999', '#bbb', '#ddd'));
	// create fadeout
	loop(4);
		#pos=(#output -> size) - (4 - loop_count);
		#output=string_insert(#output, 
			-position=#pos,
			-text=(loop_count > 1 ? '') 
				+ '');
	/loop;
	#output += '';
	return(#output);
/define_tag;

Related Tags

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft