A very tiny bug: making a radio button

I have a procedure intended to create pair of radio buttons, but they turn out not to be radio buttons. Seems like a bug, but admittedly a very small one.

newformobject "DataButtonObject",
    "rectangle",rectanglesize(154, 121, 26, 100),
    "$DataButtonRadioMode","1",
    "FieldName","rgtemp3",
    "$DataButtonStyle","Sticky Push Button",
    "$DataButtonValue","E",
    "Title","E"

newformobject "DataButtonObject",
    "rectangle",rectanglesize(154, 245, 26, 100),
    "$DataButtonRadioMode","1",
    "FieldName","rgtemp3",
    "$DataButtonStyle","Sticky Push Button",
    "$DataButtonValue","F",
    "Title","F"

I don’t understand the problem here. You asked it to create buttons using the “Sticky Push Button” style, and that’s what is created. They do operate as a pair of radio buttons - clicking on one will deselect the other one.

If you wanted it to look like a radio button, you would need to use

"$DataButtonStyle","Radio Button",

I’m thinking I must be completely missing something here? Hmm, maybe you are thinking that:

"$DataButtonRadioMode","1",

would make it look like a radio button, but what that does is affect the operation, so that only one button out of a set can be checked. But the appearance could be a checkbox, a radio button, or a sticky push button. The appearance and operation are specified independently.

In my testing, the buttons that are created do not act like radio buttons, which is what I wanted. When you examine the blueprint, the “$DataButtonRadioMode” parameter is set to “0”, not to “1”.

Same here.

Your quoted code creates two rectangular buttons which neither look like nor behave as radio buttons, even though $DataButtonRadioMode is set to "1" for both of them. And immediately after creating the buttons the blueprint shows "$DataButtonRadioMode","0",

However, if I change "$DataButtonStyle" to "Radio Button" (but change nothing else) they both look like and behave like radio buttons, and the blueprint shows "$DataButtonRadioMode","1", as the code specified when creating each button.

Thus it appears that setting "$DataButtonStyle","Sticky Push Button", is causing the specified value of "$DataButtonRadioMode" to be overridden by a default value of zero for that button style.

Thus not a bug, strictly speaking, just undocumented behaviour!

Peter, I think you are right, but you can mark a group of StickyPushButton style buttons to Radio buttons, and they work like radio buttons. They look kinda good.

When altering a button in graphics mode, changing its style between checkbox, sticky push button and radio button also sets the “Radio” button flag appropriately at the same time, which is exactly what I would expect it to do. However, that can then be overriden to make buttons in the sticky button style behave like radio buttons.

Thus when creating buttons using code rather than the user interface, I suppose the answer is to mimic that process: create the button then use changeobjects to set the $DataButtonRadioMode property to set the value that was ignored when the button was created.

This sounds familiar. I can’t remember the situation now, but I’m sure I remember a similar situation when creating some other kind of object, when I had to add a line to set a flag afterwards because it seemed to have been ignored or overridden by the newformobject statement. Again, not a bug but a feature. This is not an area which is well documented in Help, thus a lot comes down to trial-and-error.

I think it may relate to this: Checkbox or Radio Button

Although I like the appearance of the sticky push buttons, I just switched to the radio button style. They look fine also.

It appears that the

    "$DataButtonStyle","Sticky Push Button",

line automatically sets the $DataButtonRadioMode option to OFF.

So you can get what you want by changing the order, and setting the radio mode option AFTER the button style, like this:

newformobject "DataButtonObject",
    "rectangle",rectanglesize(154, 121, 26, 100),
    "FieldName","rgtemp3",
    "$DataButtonStyle","Sticky Push Button",
    "$DataButtonRadioMode","1",
    "$DataButtonValue","E",
    "Title","E"

newformobject "DataButtonObject",
    "rectangle",rectanglesize(154, 245, 26, 100),
    "FieldName","rgtemp3",
    "$DataButtonStyle","Sticky Push Button",
    "$DataButtonRadioMode","1",
    "$DataButtonValue","F",
    "Title","F"

Thanks. That worked. Back to Sticky Buttons.

Somewhat similar, when using a Segmented Button in Radio Mode, if the user adds a Procedure, the Radio Mode gets turned off. I am just wanting to add a record after the active side of the Radio Mode Segmented Button is pressed.

I cannot duplicate this. I am able to add code to the button without the mode being affected.

What does “active side” mean?


If the segmented button is linked to a field (rather than a variable), and the code in the segmented button adds a record, the button state is going to change as soon as the record is added (because the field in the new record will be different than the field in the previous record). I wonder if this is what you mean by “Radio Mode gets turned off”. This would be exactly the expected behavior.