Checkbox ☑ not updated when its "state" property changed programmatically

Hello everyone,

I have created a checkbox on a worksheet (both ways, coded it, and using form controls). In both cases, whenever I make an attempt to change its state programmatically, the checkmark does not appear/disappear. I did not analyze the one created using form control in much detail, other than observing that the behavior is the same. However, the one which I coded, I have subsequently added a mouse listener event to it, and when changing its state using code, the event triggers response. It’s just the graphical aspect of it that does not display/hide the little check mark in the box. What am I missing in this case?

Thank you kindly, in advance, for your help.

Version: 7.3.0.3 (x64) / LibreOffice Community
Build ID: 0f246aa12d0eee4a0f7adcefbf7c878fc2238db3
CPU threads: 16; OS: Windows 10.0 Build 22000; UI render: Skia/Raster; VCL: win
Locale: en-CA (en_CA); UI: en-US
Calc: threaded

AFAIK, chekbox state property is not boolean, but integer.

Dim bState As Boolean
bState = chk.State  'CBool(chk.State)

But:

chk.State = Abs(bState)  'if TRUE, that is, 1, not -1

There is no problem with disappearance. There is no problem if the checkbox is bound to a sheet cell.

Edit:
Using the triple state adds an integer value of 2. Am I wrong? In Microsoft VBA it is different: -1 (TRUE), 0 (FALSE), NULL.

1 Like

com::sun::star::awt::UnoControlCheckBoxModel::State

I saw this and went by the notion that 0 and 1 can be replaced by False and True.

Actually just like @mikekaganski states below it’s 0 and 1. Although I also noticed value -1, and did not figure out why it shows that.

Please see the four messages after that - it’s possible that the checkbox’s state is being changed, but Calc is simply not redrawing the area (some event handler is blocking this action). It’s probably easier to force redraw this area than to look for the source of the error (yes, it’s a crude and dirty solution, but it might work).

Thank you @JohnSUN . I will need to look in depth at this on Friday. For now it’s work time. If anything I’ll report with questions.