Multi Checkbox

Hello

I'm new to Fast Reports so my question may be dumb. I have the problem that I have to display three states as a checkbox: exam passed (check), exam failed (minus) and exam unknown (cross?). Is there some way to get this behaviour. As far as I can see the supplied checkbox is supporting only two states. I was looking at the image control - maybe I can use this one for my problem?

Thanks in advance
Uwe

Comments

  • edited 3:21PM
    Hello,

    CheckBoxObject supports two state only. You may emulate the third state by the following properties:
    - Checked = true
    - CheckedSymbol = Fill
    It can be done in the CheckBoxObject.BeforePrint event handler.

    You also may try to use PictureObject instead. The possible way to do this:
    - put 3 picture objects (with checked, unchecked, unknown pictures), in the same location
    - use BeforePrint event handler to hide/show pictures (via Visible property) to display the picture you need.
  • edited 3:21PM
    AlexTZ wrote: »
    Hello,

    CheckBoxObject supports two state only. You may emulate the third state by the following properties:
    - Checked = true
    - CheckedSymbol = Fill
    It can be done in the CheckBoxObject.BeforePrint event handler.

    You also may try to use PictureObject instead. The possible way to do this:
    - put 3 picture objects (with checked, unchecked, unknown pictures), in the same location
    - use BeforePrint event handler to hide/show pictures (via Visible property) to display the picture you need.
    Thanks for the quick response. I will try out your suggestions.
  • edited 3:21PM
    I'm sorry to bother you again.

    But I don't get the way how to work with the BeforePrint Event with the checkbox. I thought of something like: getting the current data (which is 0,1 or 2) and then set the properties according to it. But I can't find a way to read the current value of the field which is bound to the checkbox. Sorry again, as I think this is really a noob question.
  • edited 3:21PM
    Do not bind the data to a checkbox. Use this code (BeforePrint event):
    int value = (int)Report.GetColumnValue("YourTable.Column");
    switch (value)
    {
      case 0:
        CheckBox1.CheckedSymbol = CheckedSymbol.Check;
        CheckBox1.Checked = false;
        break;
      case 1:
        CheckBox1.CheckedSymbol = CheckedSymbol.Check;
        CheckBox1.Checked = true;
        break;
      case 2:
        CheckBox1.CheckedSymbol = CheckedSymbol.Fill;
        CheckBox1.Checked = true;
        break;
    }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.