1. Dan Cooperstock
  2. PowerBuilder
  3. Saturday, 13 April 2024 19:16 PM UTC

I have a radiobutton style column in a DW (PB 2021) that normally has 3 options. However, depending on some situations I need to change it to only 2 or only 1 option, with varying text. To set it to only 1, I use code like:

dw.object.columnName.values = "some text~tsome value/"

After doing that, the control entirely disappears. (And that's whether or not there is a trailing forward slash.) If I instead change it to have 2 options, it displays fine.

Is this a known bug? Something I'm misunderstanding?

Sure, I know that normally radio buttons don't have only one option, but if I create it like that (one option) in the painter it's fine. It's only when I change it at runtime that it disappears.

Thanks.

Miguel Leeuwe Accepted Answer Pending Moderation
  1. Sunday, 14 April 2024 20:42 PM UTC
  2. PowerBuilder
  3. # 1

Have you tried doing a SetRedraw(true) after your modify?

Comment
  1. Dan Cooperstock
  2. Sunday, 14 April 2024 20:49 PM UTC
Just tried that, no change.
  1. Helpful
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Sunday, 14 April 2024 16:16 PM UTC
  2. PowerBuilder
  3. # 2

Hi Dan,

When you say "...but if I create it like that (one option) in the painter it's fine." do you mean that it displays in the painter fine or even when you run it, it still displays fine? Testing in 2019R3 and 2022R3 both show fine in the painter as well but when you run it the control is still not displayed, so it doesn't appear to matter whether it's created in the painter or in code, a single option will still not display when run (from the IDE).

If yours displays when run as well with only one option provided at design time I'm intrigued to know what might be the difference, unless it's PB 2021 that makes the difference and I don't have it installed on my machine to test.

John's suggestion would work assuming that at no time, whether it's with 3, 2, or 1 option(s) the user is permitted to select none of the options (otherwise you need two graphics, one unfilled to start and one filled in if clicked). Similar to John's idea, you could hide the radiobutton when it only has one option and insert a checkbox control (or better yet create it at design time and then unhide it) and programmatically set the radiobutton's value based upon the status of the checkbox if they don't have to make a selection. If they do have to physically make a selection even when there's only one choice, then maybe still show the full set of options but programmatically select the one they would have to choose if there was only one option and then disable the control.

I'm just not sure yet there is a bug at play here but maybe I'm missing something.

HTH...regards,

Mark

Comment
  1. Dan Cooperstock
  2. Sunday, 14 April 2024 20:49 PM UTC
I think you may be right, Mark, I tried that again and I actually couldn't even save the DW that way with that change in the painter to have only one radiobutton option.
  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Sunday, 14 April 2024 01:51 AM UTC
  2. PowerBuilder
  3. # 3

Hi, Dan - 

Stylistically speaking, radio buttons are used to select one of multiple, exclusive options. The Microsoft Windows style guidelines are clear about that:

    https://learn.microsoft.com/en-us/windows/apps/design/controls/radio-button

Thus, I don't think this is a bug.

If there is no possibility of choosing an alternative option in the scenario you describe, you might consider presenting a faux alternative; hide the column and in its place display a small graphic of a filled-in radio button along with a static text as if there was a single, radio button was visible.

Others may have alternative ideas.

Best regards, John

Comment
  1. Dan Cooperstock
  2. Sunday, 14 April 2024 02:30 AM UTC
That's something like what I have done in the interim, John. However, it doesn't explain why a radiobutton style DW column designed in the painter with only one option does display. It's only if you change it to have only one option in code that it disappears. Also, if this is the intended behaviour, it should be explained somewhere in the PB help.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.