1. CJ Lai
  2. PowerBuilder
  3. Friday, 30 June 2023 21:40 PM UTC

Hi All

I have a dwo with only one column in it. I made that column's edit style 'RadioButtons' with Yes, No, and Maybe 3 options in it to start.

During the run time, I am able to manipulate those options to only display Yes and No, or Yes and Maybe, or No and Maybe but fail to list only one option display, any one.

This is the Modify I use to manipulate it

dw_1.modify("consent_option.values = 'Yes~tY/No~tN/Maybe~tM/'")

It works with 2 or 3 options listed but the dwo comes up blank if I have the Modify only contain one, any one.

It works when

dw_1.modify("consent_option.values = 'Yes~tY/No~tN/'")  - with any combo

but fails when only have one listed

dw_1.modify("consent_option.values = 'Yes~tY/'") - dwo comes up blank so does this one

dw_1.modify("consent_option.values = 'Yes~tY'")

 

I have checked my dwo settings and sizes all that but none helped/mattered.

Please advise.

Much appreciate it.

CJ

Accepted Answer
John Fauss Accepted Answer Pending Moderation
  1. Monday, 3 July 2023 15:22 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi, C J -

I suggest that the reason what you are attempting to do does not work is because radio buttons are designed to present two or more options:

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

Given this, I think it unlikely you will be able to force a radio button to do what you are wanting. Perhaps the business requirement that is driving this issue needs to be revised.

Best regards, John

Comment
  1. CJ Lai
  2. Monday, 3 July 2023 15:41 PM UTC
Thank you so much, John. I was wondering if there was such documentation out there to my suspicion. I am grateful you shared it. Much appreciated!
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 30 June 2023 22:10 PM UTC
  2. PowerBuilder
  3. # 1

Hi,

This is not really an answer to your question, but what use is a radio button with only one option? You might just as well change the edit style to Edit, set the value and make it not editable, since there's only one possible option.

So what I'm saying is that you could dynamically modify the edit style.

regards.

Comment
  1. Brad Mettee
  2. Saturday, 1 July 2023 17:26 PM UTC
You could add a 4th option for 'None of the above', that it defaults to, and is NOT a valid option to save, that way you always have two options and force the user to choose one.
  1. Helpful
  1. CJ Lai
  2. Monday, 3 July 2023 13:36 PM UTC
Hi Brad,

That would have been an option but per our business requirement, when the user is left with one option, they want that one option listed in the DW. Just that one.
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 3 July 2023 22:25 PM UTC
Windows controls have a specific use case to them. It's a pity that your 'business' doesn't have a clue about how different windows controls work are supposed to be used and ask for the wrong things. We've all been there though :)
  1. Helpful
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 3 July 2023 13:27 PM UTC
  2. PowerBuilder
  3. # 2

When you have only one option, why not set the value and PROTECT that field. 

 

Comment
  1. CJ Lai
  2. Monday, 3 July 2023 13:35 PM UTC
Thank you, Sivaprakash. The issue at hand is when there is only one radiobutton option coded in the DW at runtime, the DW shows up blank/empty. that's why I am here to seek any advice to make the DW work.
  1. Helpful
  1. Sivaprakash BKR
  2. Monday, 3 July 2023 13:57 PM UTC
dw_1.modify("option1.values = 'Why~tY/ ~t '")

dw_1.Modify("option1.Protect = 1")



This shows up two radio buttons, one with required option and other with empty values. Since that field is protected, User can't choose or do anything.

This may NOT be a desired solution, but it might work in your case, if you / end users are not that much worried about the second option shown as blank.

  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Monday, 3 July 2023 14:48 PM UTC
  2. PowerBuilder
  3. # 3

Personally I would use a ddlb or dddw edit style. A radio button is not the most ideal edit style for your requirements.

That would allow you to do whatever you want, but of course ... maybe you MUST use a radiobutton.

 

Comment
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.