3 State Check Box - Possible in Servoy?

In .NET / MSSQL I’ve grown to like the 3 state checkbox available there. Used primarily in search criteria, the three states are:

Empty box - Return records where this value IS NOT TRUE
Box colour (UK Only LOL) filled - Return records where this value IS TRUE OR NOT TRUE
Check in the box - Return records where this value IS TRUE

So, in one search form and one checkbox you can say if you want records where the value is true, not true or either.

It’s sort of spoiled me now :P (we used to have two checkboxes for true or not true in search forms before this version), and since I want to try and use my Servoy main form for searching rather than create a special one, I was wondering if anyone has created / discovered a means of making that work?

Since all my ‘bit’ columns in MSSQL are treat as ‘int’ in Servoy I’m thinking perhaps I should take advantage of that and use a 0,1,2 value in the search form. Course that would entail some code and possibly still two check boxes / option buttons (maybe only visible in search mode or something)???

Anyone done something similar or know of another option? :?:

TIA

As far as I know, did some searching, this is not offered by Java.
There are 3rd party libraries but that would mean Servoy has to implement them or somebody has to make it a bean so you can use it.

An alternative would be that you create an image of the ‘3rd state’ and make that visible when you want instead of the real checkbox.
Another alternative is maybe to play with the background color.

IT2Be:
As far as I know, did some searching, this is not offered by Java.
There are 3rd party libraries but that would mean Servoy has to implement them or somebody has to make it a bean so you can use it.

An alternative would be that you create an image of the ‘3rd state’ and make that visible when you want instead of the real checkbox.
Another alternative is maybe to play with the background color.

I’m sure I can make it look the part Marcel - I was really wondering if there was some sort of functionality to make it work easily though, without re-inventing the wheel. From your post (and I know you know your stuff on what’s available in Java) I guess there is nothing. It’s not a huge deal to create a routine for this - just means a straight forward search on a current form now becomes a customised form search.

I suspect a three option button set-up would be the most intuitive to implement for the user (1= True, 2 = False, 3 = Any).

Thanks for the feedback Marcel.

you can have 3 results with checkboxes.

the status can be null (the unknown value)
the status can be 0
and the status can be 1

is this what you mean?

Harjo:
you can have 3 results with checkboxes.

the status can be null (the unknown value)
the status can be 0
and the status can be 1

is this what you mean?

Yes Harjo, that’s exactly what I mean - the challenge is, if you don’t touch a checkbox it is unknown, if you check it it becomes 1 (true) but if you then uncheck it becomes 0 (false), it never reverts to unknown but only to 0.

In MSSQL you can cycle through all these states by clicking multiple times on the checkbox. I’d suggest the challenge in Servoy is knowing which of the two states it’s in - unknown or false - as they both display nothing.

I know it is not what you are looking for but you can also use three radios next to each other…

IT2Be:
I know it is not what you are looking for but you can also use three radios next to each other…

Thats what I mentioned above Marcel

“I suspect a three option button set-up would be the most intuitive to implement for the user (1= True, 2 = False, 3 = Any).”

Options / Radios - all the same!! :lol:

Thought of another way that I can set-up as a Global Method to use on any form. Basically:

If form is in Find()
Checkbox_OnAction user Cycles through Values Null, 0, 1, each time he clicks on it.

For each Point the Cycle reaches Null - set border on Checkbox to line 3px and Black (or similar) and set the value to Null.

i.e.

if current value = 1 then new value = Null & BorderSet
Else
BorderSet (back to normal)

Or am I being simply naive? If I’m not immediately shot down I’ll give it a try tomorrow.

Hi Ian,

There was a discussion covering this subject in thread:http://forum.servoy.com/viewtopic.php?f=2&t=10815

It may give you another perspective…

Cheers
Harry

Harry Catharell:
Hi Ian,

There was a discussion covering this subject in thread:http://forum.servoy.com/viewtopic.php?f=2&t=10815

It may give you another perspective…

Cheers
Harry

Thanks Harry - that’s pretty much presenting the same thing - and I think the same potential solution.

I’m going to play with this - this week - keep you posted.

May be this one be helpful. http://www.servoy.com/forum/viewtopic.php?f=15&t=11317

This is a TriStateCheckBox bean with three states , “NOT_SELECTED”, “CHECKED”, “CROSSED”. Put the Jar file in the beans directory of Servoy root folder and Try with sample solution.

Thank you Arup!

This bean pretty much does what we are looking for.
It does require more scripting since it isn’t connected to a dataprovider but that is doable depending on the implementation.
I also noticed it doesn’t use any LAF (well it uses the Metal LAF by default actually). This is because other LAF’s don’t have a third state ?

ROCLASI:
Thank you Arup!

This bean pretty much does what we are looking for.
It does require more scripting since it isn’t connected to a dataprovider but that is doable depending on the implementation.
I also noticed it doesn’t use any LAF (well it uses the Metal LAF by default actually). This is because other LAF’s don’t have a third state ?

Thanks Robert. Yes, It uses the default cross platform metal look and feel. I have to do more coding to support for other Look and feel :wink: .