The following code is an example of how to create a red label on a form using the Scripting Tool.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | public function OnAfterTransaction(sender: Object, e: TransactionEventArgs) { // The Content comes from the transaction, so we set it here if it has a value var vCommentTransValue = form.GetTransactionValue("COMMENTS-MSG"); // If the value from the transaction is Comments Exis we set a new value before it // goes to display if(vCommentTransValue == "Comments Exis") { form.SetTransactionValue("COMMENTS-MSG", "Comments"); // Style it Red and Bold ChangeLabelStyle(); } } // private functions private function ChangeLabelStyle() { // Grab the comment label var lblComments = form.GetElement("COMMENTS-MSG"); // Change its style lblComments.Foreground = System.Windows.Media.Brushes.Red; lblComments.FontWeight = FontWeights.Bold; } |
public function OnAfterTransaction(sender: Object, e: TransactionEventArgs)
{
// The Content comes from the transaction, so we set it here if it has a value
var vCommentTransValue = form.GetTransactionValue("COMMENTS-MSG");
// If the value from the transaction is Comments Exis we set a new value before it
// goes to display
if(vCommentTransValue == "Comments Exis")
{
form.SetTransactionValue("COMMENTS-MSG", "Comments");
// Style it Red and Bold
ChangeLabelStyle();
}
}
// private functions
private function ChangeLabelStyle()
{
// Grab the comment label
var lblComments = form.GetElement("COMMENTS-MSG");
// Change its style
lblComments.Foreground = System.Windows.Media.Brushes.Red;
lblComments.FontWeight = FontWeights.Bold;
}
