gNewValue sets the text of New Value on the ToDo-list-panel.

Here you will find examples to use gNewValue.

gNewValue sets the text of New Value on the ToDo-list-panel. You can set it in load-scripts called by ToDo-List. Only calls from the ToDo List allocates this variable. In all other calls to load scripts, its value is 0, so always check it! Take care not to change the current document in any way in case of gNewValue not equal 0. This may cause serious problems.

ab v3.3.1 R3609, 9. Apr 2013 gNewValue is also defined in text layout rules. Imagine, you have a price placeholder and a rule to add the currency. If you check such placeholders using the ToDoList management, you will get "out of syncs" for every of such placeholder. (Because, you database contains the value, say, 19.99. But your document contains the text 19.99$.). To solve this problem, the ToDoList management executes all text rules too. What you have to do is writing you changes into gNewValue. Its quite easy:

  1. The rule/condition does NOT USE gNewValue The rule/condition is ignored by the ToDoList management.
  2. The rule/condition does not change the content. Leave gNewValue untouched and leave rules asap (see example 2). Conditions should be executed. If the condition needs the placeholders content, use gNewValue instead of document (see example 3).
  3. The rule changes content.Take the current value from gNewValue (not from the document). Make you changes and write it back to gNewValue (see example 3).

gNewValue is capable of 2 GB of characters.

Very simple load script with ToDoList-Support.

int main ()
    char		str[256];
strcpy (str, "my value");
if (gNewValue) { strcpy (gNewValue, str); return 0; }
textmodel::replace (str); return 0; }

Text rules not changing the placeholders CONTENT should leave the script as soon as possible.

int main ()
    if (gNewValue) return 0;
textmodel::set_color (gFrame, ...); return 0; }

Code snippet of a content changing text rule.

int main ()
    String		txt		= string::alloc ();
    char		str		[8000];
if (!gNewValue) { textmodel::gettext (txt); strcpy (str, string::get (txt)); } else strcpy (str, gNewValue);
// Change str
if (gNewValue) { strcpy (gNewValue, str); return 0; }
// Change textmodel
return 0; }

Version 2.1, R 773
See Also

Alphabetic index HTML hierarchy of classes or Java