Lasso Soft Inc. > Home

[mv_timeMenu]

Linkmv_timeMenu
AuthorMarc Vos
CategoryCustom Tag
Version8.5.x
LicensePublic Domain
Posted22 Jul 2010
Updated20 Feb 2012
More by this author...

Description

This tag creates time entries for a pop-up menu. You can specify from / to hours and the steps in minutes. You can also pass a value to test against so the 'selected' switch is set on when the value passed closely or exactly matches an entry. The test value cannot contain a colon. 20-feb-2012: Completely rewritten. -fromHour and -toHour now require the minutes specified. You can now start at any time, the routine determines the closest starting value and adds up the interval in minutes from there. You can specify any number now in the -minutes parameter; the routine will figure out itself the numbers of hours/minutes to use as the interval.

Sample Usage

[
var('FormField1' = mv_clctim(-time1=action_param('FormField1'), -action='FS');
var('FormField2' = mv_clctim(-time1=action_param('FormField2'), -action='FS');]

...
...



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.

// Creates a list of time values inside a , which you code & style// Example: define_tag('mv_timeMenu', -optional='fromhour', -copy, -optional='tohour', -copy, -optional='minutes', -copy, -optional='selected', -copy, -optional='firstblank', -EncodeNone);	local('result' = '', 'p' = 0, 'z' = 0, 'h' = 0, 'm' = 0, 'y' = 0, 'f' = false);
	if(! local_defined('firstblank'));		local('firstblank' = 0);	else(integer(#firstblank) <= 0);		#firstblank = 0;	/if;	#firstblank = integer(#firstblank);
	if(! local_defined('fromhour'));		local('fromhour' = 0);	else(integer(#fromhour) <= 0);		#fromhour = 0;	/if;	#fromhour = integer(#fromhour);
	if(! local_defined('tohour'));		local('tohour' = 2359);	else(integer(#tohour) <= 0 || integer(#tohour) >= 2400);		#tohour = 2359;	/if;	#tohour = integer(#tohour);
	if(! local_defined('minutes'));		local('minutes' = 15);	else(integer(#minutes) <= 0);		#minutes = 15;	/if;	#minutes = integer(#minutes);		if(#firstblank);		#result = '';
		#p = #z;				// Save previous time				#h = integer(#z / 100);	// Take hours-part		#m = #z - (#h * 100);	// Take minutes-part		#m += #minutes;			// Add interval to the minutes to get total-minutes		#y = integer(#m / 60);	// Calculate how many hours total-minutes contains		#h += #y;				// Add those hours to the hours-part		#m -= (#y * 60);		// Subtract the hours from total-minutes		#z = (#h * 100) + #m;	// Construct new time	/while;
	return(#result);/define_tag;

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