Jump to content
tony.huerlimann

looking for a "special" checkbox component

Recommended Posts

The ordinary TCheckBox has just two states: checked and not checked. I need a checkbox with three states: checked, "half-checked" , not checked. (Or with multiple states). Exists there such a component in VCL or FNC?

 

(I have an application where the user should choose between three states: "yes it's ok", "no, it's not", "not sure". What other component could be used?)

Thanks

Tony

Share this post


Link to post

A TCheckBox with AllowGrayed set to true has three possible states; checked, unchecked, and grayed according to http://www.delphigroups.info/2/6/245597.html  

I thought TRzCheckbox might have more, but the thread seems to think not...

 

Edit: here's the VCL documentation on it: https://docwiki.embarcadero.com/Libraries/Sydney/en/Vcl.StdCtrls.TCustomCheckBox.AllowGrayed

3states.gif

Edited by Tom F
  • Like 2

Share this post


Link to post

I advise against the use of TCheckBox or similar for such an input. There are multiple reasons: "greyed" state doesn't clearly mean "not sure" AND you might have to click twice to change your answer from one answer to the other.

I'd suggest to have three radio buttons, right next to each other, with each column having a title; like an online questionare.

 

Somthing like this:

image.thumb.png.3889e7bec572997b6e0008ff0a2b9689.png

Edited by aehimself
  • Like 4

Share this post


Link to post

If UI space is an issue, you could use a TComboBox with Style=csDropDownList instead, and just have 3 items to choose from.

Share this post


Link to post

A ComboBox suffers from the same 2-click issue and while it does save space, still not the usual way to handle these inputs. If UI space is an issue you should be looking at how to increase the space, not on workarounds.

 

Unfortunately at work people were doing something similar and just pulled things closer together when they ran out of UI space (or the infamous pagecontrols on tabsheets). The end result physically hurts to look at.

Share this post


Link to post

The DelphiGroups post I linked to previously mentions That Raize allows customizable glyphs.  So, if the grayed out box as a third state is too ambiguous for you, you might check out is TCheckbox to see if you can modify the appearance of his checkboxes in a way that works for you.

I was thinking of something like the one below, although I imagine that there are legitimate objections to the ambiguity as well as how difficult it might be to differentiate such a small difference in appearance between the second and third one.  

 image.png.44a78c4a04142d5307c2b551006faa81.png

Share this post


Link to post
3 hours ago, aehimself said:

A ComboBox suffers from the same 2-click issue

What, 1 click to open the list, and 1 click to select?  I really don't think that is much of an issue.  But if it is, then just use TRadioGroup/3xTRadioButton instead.

Edited by Remy Lebeau

Share this post


Link to post
On 9/4/2023 at 6:09 PM, tony.huerlimann said:

I have an application where the user should choose between three states: "yes it's ok", "no, it's not", "not sure". What other component could be used?

Radio group:

- Yes it's OK

- No it's not

- Not sure

 

 

Share this post


Link to post
13 hours ago, aehimself said:

I found the meme about it:

Well, business software and user software are two different things. I'd prefer many controls on a single form instead of tens of tabs with 2-3 controls on each (if you have to loop through all of them anyway).

Just like a launchpad of an airplane. I doubt pilots would want to change all these buttons to a single touch screen.

  • Like 1

Share this post


Link to post
3 hours ago, Fr0sT.Brutal said:

Well, business software and user software are two different things. I'd prefer many controls on a single form instead of tens of tabs with 2-3 controls on each (if you have to loop through all of them anyway).

Just like a launchpad of an airplane. I doubt pilots would want to change all these buttons to a single touch screen.

Its also a bit silly to compare a full user-info input screen with a single drop-down or touch button.. 🤪

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×