Conditional Formatting Follow

0
Avatar
Legacy Poster

I am trying to change a text field font selection "White on Black" based on a value in

in my case_description datebase field. It supplies 2 values. "NS" and "Standard".

If the value is "Standard" I want no selection. If it is "NS" I want "White on Black" selected.

Is this possible with Vbscript. Any help would be appreciated.

6 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

The quick answer is yes.  See the following white paper: http://www.seagullscientific.com/label-software/whitepapers/dynamically-changing-objects-at-print-time-using-vb-script.pdf

 

Object properties to adjust would be:

 

Object.TextBackgroundColor = Color

 

Object.TextColor = Color

 

See the BarTender help system for a full reference of all properties available.

0
Avatar
Legacy Poster
Comment actions Permalink

I tried this as a test but can't get it to work.

 

Set Notice = Objects("Text_16")

If (Field("case_description") = "NS") then

Notice.TextColor = btColor.RedColor.

Else Notice.TextColor.Green

end if

0
Avatar
Legacy Poster
Comment actions Permalink

I read the documentation. It doesn't work. Not a big surprise.

0
Avatar
Legacy Poster
Comment actions Permalink

What's with the tone...? I got this to work in like 2 minutes just now, so...

  1. Make the database connection
  2. Create a dummy BarTender text object to hold the database value
  3. Assign a name to the data source of that object/substring
  4. Go to File > BarTender Document Options > VB Scripting
  5. Check "Use VB Scripting", add something like the below code to the "OnNewRecord" event
If Format.NamedSubStrings("bg_val").Value = "NS" Then
	Format.Objects("test").TextBackgroundColor = Black
	Format.Objects("test").TextColor = Red
Else
	Format.Objects("test").TextBackgroundColor = Green
	Format.Objects("test").TextColor = Black
End If

..whereas "bg_val" is the name of the data source that holds the database value and "test" is the name of the (BarTender) object you want to manipulate.

0
Avatar
Shotaro Ito
Comment actions Permalink

When you use Seagull driver, make sure print box as [Raster Graphics],

From Print dialog > Object Print Method > Box.

Also do not use device font (Printer font), use Truetype / Opentype font.

0
Avatar
Legacy Poster
Comment actions Permalink

I finally got it to work. I was overlooking the named data source. Thanks for the info.

Please sign in to leave a comment.