lundi 4 janvier 2021

Having red checkbox in MFC in a way that the user can't change the state of the checkbox?

I have a list control on a dialog. This control should not be editable, so no values should be changed by the user.

I have a few columns of checkboxes in this table, this is only to display data to the user in an easy to read format. The problem is that if the columns of checkboxes are not editable, the ticks in the boxes are grey, making them hard to see, so by request I have to make it red (like when it's editable).

If I call myCVirtualListControl.SetColumnEditable(x, true, true); then they look like as they should but the user now can edit it which is not the desired functioning.

I thought of a way of solving this, maybe there is an event that is broadcasted when the user click's a checkbox so I could just listen to that and set the checkbox's state back to it's original in an instant, possibly without the user even seeing that he unchecked or checked the box. Sadly I couldn't find anything about this, not in ms docs, nor google, neither StackOverflow.

The closest I found was this answer saying

Note that Check boxes and Radio buttons are Buttons. So they send click and double click messages, BN_CLICKED and BN_DOUBLECLICKED.

But no further information is found about how can I listen for these and what information do they contain.

Any help would be appreciated, please consider that I am a noob with mfc.




Aucun commentaire:

Enregistrer un commentaire