2.2.4.24.21 Layer::LT_set_str

Description

Set LabTalk string variable while the Layer Object layer is the active layer.

Syntax

BOOL LT_set_str( LPCSTR lpcszVar, LPCSTR lpcszContent )

Parameters

lpcszVar
[input] Origin string variables, %A through %Z, as well as LabTalk Object string properties
lpcszContent
[input] string content to be copied to Origin string variable, can be NULL to empty a string

Return

Return TRUE if success, return FALSE if string variable is not correctly specified or string is too long.

Examples

EX1

//Update and output the sheet's name.
void    Layer_LT_set_str_ex1()
{
	char    szBuffer[200];
	Worksheet wks;
	wks.Create("Origin");
	//Get the sheet's name.
	wks.LT_get_str("layer.name$", szBuffer, 200);
	out_str(szBuffer);
	//Set the sheet's name.
	if(wks.LT_set_str("layer.name$", "MySheet"))
		out_str("set sheet's name success");
	else
		out_str("set sheet's name failed");
	wks.LT_get_str("layer.name$", szBuffer, 200);
	out_str(szBuffer);
}

Remark

Sets the value of a LabTalk global string variable or a LabTalk object string property.

The Layer Object is only temporarily set as the active layer. The Layer that was active before the code executes is restored as active upon return.

See Also

Layer-LT_get_str

Header to Include

origin.h

Reference