THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/01/2011 at 05:25, xxxxxxxx wrote:
You can't prevent this for the COFFEE tag. You have to use a ExpressionPluginTag. There you can store the values in a member variable. To keep the data of the member variable intact you also need to override the Copy Save and Load methods of the base class.
Here is a simple example showing the concept. The variable text is my 'global' variable.
class MyExpressionPluginTag : ExpressionPluginTag
{
var text;
public:
MyExpressionPluginTag();
GetID();
MultipleAllowed();
DisplayAllowed();
GetHelpText();
UseMenu();
GetName();
Edit();
Execute(doc, op);
Copy(dest);
Save(hf);
Load(hf);
}
MyExpressionPluginTag::MyExpressionPluginTag()
{
// Call the parent constructor
super();
}
MyExpressionPluginTag::GetID()
{
return 1025002;
}
MyExpressionPluginTag::MultipleAllowed()
{
return FALSE;
}
MyExpressionPluginTag::DisplayAllowed()
{
return TRUE;
}
MyExpressionPluginTag::GetHelpText()
{
return "test";
}
MyExpressionPluginTag::UseMenu()
{
return TRUE;
}
MyExpressionPluginTag::GetName()
{
return "test";
}
MyExpressionPluginTag::Edit()
{
}
MyExpressionPluginTag::Execute(doc, op)
{
if (text == nil) text = "hello";
else text = "world";
println(text);
}
MyExpressionPluginTag::Copy(dest)
{
//copy variable to destination
dest->text = text;
}
MyExpressionPluginTag::Load(hf)
{
if (text != nil) text = hf->ReadString();
}
MyExpressionPluginTag::Save(hf)
{
if (text != nil) hf->WriteString(text);
}
main()
{
Register(MyExpressionPluginTag);
}
cheers,
Matthias