Adding And Removing Background Color During Printing Follow

0
Avatar
Legacy Poster

I'm trying to add background color to a field when Text is detected, and remove when no data is detected. I can use:

(Format.Objects("Text 13").TextBackgroundColor = BtColor.black) to add the background color to the field, The problem I have is removing that when no test is present in that field.

3 comments

0
Avatar
Michael Toupin (mtoupin
Comment actions Permalink

All you'd need to do is use TextBackgroundColor - BtColor.white to get it back to the white background if the data isn't detected.

0
Avatar
Legacy Poster
Comment actions Permalink

Problem still there when printing the label.  I’m loading this script via the following

 

 

 

  • File

 

  • Label Format option

 

  • OnNewRecord (VB Scripting)

 

  • Entering the following:

 

 

 

  1. Format.Objects("Text 13").TextBackgroundColor - BtColor.White

 

  1. Format.Objects("Text 13").TextBackgroundColor - BtColor.White

 

 

 

As I stated before, it will add the background when text is detected, but will not remove when no text is detected.

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

All what you would need to do is to verify if the value of the text object in question is empty:

 

If Format.Objects("Text 13").value = "" Then

   ...

Else ....

End If

 

You will find a full reference on this on BarTender's Help (F1 key within BarTender) by accessing the "Visual Basic Scripting > Scripting Objects > Object Reference > Object Object" topic.

Please sign in to leave a comment.