[FREE] 3-State CheckBox Bean for Servoy

Here is a 3-State Check Box bean for Servoy.

The 3-State Check Box Bean has the three states called, “NOT_SELECTED”, “CHECKED”, “CROSSED”. Put the Jar file in the beans directory of Servoy root folder and Try with sample solution. You can get/set the state by using the state property of the bean.

To Get the State :

var state = elements.bn_triState.state

To Set the State :

//Set to Checked
elements.bn_triState.state = "CHECKED";

//Set to Not Selected
 elements.bn_triState.state = "NOT_SELECTED";

//Set to Crossed
elements.bn_triState.state = "CROSSED";

TriStateCheckBox.jar (8.24 KB)

TriStateDemo.servoy (28.6 KB)

WOW Arup - looks like you’ve been thinking about this for a while!

For clarity:

NOT_SELECTED = when a form first opens and the checkbox has not been touched ( = NULL)?

CHECKED = When the ‘tick’ appears in the box and its set to True (1)?

CROSSED = When the box is set to false (0)(no checkmark)?

Thanks for the effort in making this available.

Hi Kahuna,

Kahuna:
NOT_SELECTED = when a form first opens and the checkbox has not been touched ( = NULL)?

In a search scenario this would mean don’t search on it. In a data entry scenario this could be 0 for an integer or ‘false’ for a varchar. Or pretty much any value you can think of since you need to script the actual data entry into the dataprovider.

Kahuna:
CHECKED = When the ‘tick’ appears in the box and its set to True (1)?

In both scenarios this would be true/1

Kahuna:
CROSSED = When the box is set to false (0)(no checkmark)?

Now this one is a tricky one. When you do data-entry with a 2-state checkbox then this third-state would be used only in a search scenario and would mean 'not checked, i.e. 0/null/false.
But if you use tri-state values in data-entry then you need a four-state checkbox for searching the ‘not-selected’ values. Which of course what triggered this whole thread to begin with.

Kahuna:
WOW Arup - looks like you’ve been thinking about this for a while!

For clarity:

NOT_SELECTED = when a form first opens and the checkbox has not been touched ( = NULL)?

CHECKED = When the ‘tick’ appears in the box and its set to True (1)?

CROSSED = When the box is set to false (0)(no checkmark)?

Thanks for the effort in making this available.

Thanks Kahuna :)