views:

896

answers:

5

What is the best way to display a checkbox in a Crystal Report?

Example: My report has a box for "Male" and "Female", and one should be checked.

My current workaround is to draw a small graphical square, and line it up with a formula which goes like this:

if {table.gender} = "M" then "X" else "  "

This is a poor solution, because changing the font misaligns my "X" and the box around it, and it is absurdly tedious to squint at the screen and get a pixel-perfect alignment for every box (there are dozens).

Does anyone have a better solution? I've thought about using the old-style terminal characters, but I'm not sure if they display properly in Crystal.

Edit: I'm using Crystal XI.

+1  A: 

Try a pair of images with a conditional formula for visibility

MarkB
Not a bad idea, but still hacky. Nothing built-in I guess?
JosephStyons
I don't know of anything built in. Toggling images is not that uncommon.
MarkB
+1  A: 

2 pictures
1 - Empty box
2 - Checked box

Display the right picture with a formula

Hapkido
+1  A: 

An alternative to images could be to use the Wingdings font; Characters 0xFE (checked) and 0xA8 (unchecked).

jons911
A: 

I never use a box...I always use a textfield object with a full border, centered alignment and bold. Type an X inside to size it right. Erase the "X". Copy/paste as many as you need.

Then I create all the formulas that return either "X" or " " (the space is important, otherwise border will not display on the text object). Then simply plop the formula fields into the right boxes.

Also, if you want to align these bordered text objects you need to remove the border before aligning. That bug really annoys me!

dotjoe
A: 

If {Table.Field} = True Then

'Display the checkbox of your choice here

Formula = Chr(254)

Else

'Display empty checkbox

Formula = Chr(168)

End If

hatem gamil