Skip to content

Form.cc: fix radiobutton reporting wrong state

When a radiobutton (belonging to a normal radiobutton group) has a /V key matching his OnStr state, then when you ask that radiobutton for his state (eg. radiobutton->state()) it will wrongly return true, when really the active radiobutton is another one in the group.

This happens because the faulty radiobutton is not passing the getState() call to his Parent (which every radiobutton in a group should do, as the Parent stores the value of the current active item).

The code was not doing it because it had a valid AppearanceState (/V key). That behaviour may be right for checkboxes but not for radiobuttons.

A testcase is included. An example definition of an affected radiobutton follows:

/F 4
/FT /Btn
/Ff 49152
/AP /N /Beer 59 0 R /Off 61 0 R
/AS /Beer
/MK /BC [1,0,0] /BG [1,1,1] /CA (4)
/P 20 0 R
/Parent 8 0 R
/Rect [235.277,654.247,249.224,668.194]
/Subtype /Widget
/Type /Annot
/V /Beer

Fixes issue #159 (closed)

Edited by Nelson Benítez León

Merge request reports