Making DW Radio Buttons and Check Boxes look disabled
An effective GUI quickly communicates to the users how they can interact with the current window. For most datawindow edit styles, PowerBuilder supplies its developers with the means to visually show if it is available to accept user input. Unfortunately, if you are working with an older version of PB, how to show a disabled check box or a radio button is a puzzle. Here is how I deal with this issue.
Below is a datawindow from one of my company’s applications written in PB 7.0 . The Edit and dddw edit styles indicate its protected status with its background color: white for enabled, buttonface for disabled. The radio button and checkbox edit styles do not have this option. In order to find out if the column is enabled or not, the user must actually click on it and see if changes.
My solution is to use the 3D look for enabled radio buttons and check boxes. When a radio button or check box is disabled, I switch the object to 2D. So the datawindow changes to look like this:
This does the job of clearly communicating to the user that the radio button “Weight Verify Physical Pallet” and the check boxes “Taxable” and “Newspaper” are disabled, while the other two check boxes are available to be selected and changed.
To achieve this 2D disable look in script, you can use modify script similar to the following:
ls_mod = “newspaper.Edit.Style.CheckBox.3D=No”
dw_1.Modify(ls_mod)
ls_mod = “wgt_vrfy.Edit.Style.RadioButtons.3D=No”
dw_1.Modify(ls_mod)
Another way to achieve this result is to borrow the technique discribed in the post The Ol’ Hidden Items in the dddw Part II. This method also deals with tabular datawindow styles where multiple rows are displayed and the radio buttons and check boxes may be enabled in some rows, and disabled in others.
In this method, for each radio button or check box edit style, the datawindow has two copies of each of these columns. One copy would not be protected and have the enabled 3d look, the other would be protected with the disabled 2D look. The disabled copy would sit directly under the enabled copy. Use a datawindow expression to determine the protect property and reuse this expression for the visibility property. When the column is enabled, the visibility property of the enabled column would be turned on, and the visibility property of the disabled would be turned off. When the column should be disabled, the visibility properties of the two copies would be reversed. Voila!
Another option is to upgrade to 11.5 which fixes this issue.
On a side note, pressing the space bar is the keyboard shortcut to toggle a check box with focus.
7 Comments »
Leave a Reply
-
Archives
- August 2009 (2)
- May 2009 (1)
- March 2009 (1)
- January 2009 (2)
- December 2008 (1)
- November 2008 (2)
- September 2008 (1)
- August 2008 (1)
- July 2008 (24)
- June 2008 (22)
- May 2008 (69)
- April 2008 (25)
-
Categories
-
RSS
Entries RSS
Comments RSS


Could you please give me the solution of how all radio buttons can be kept unchecked in PowerBuilder 11.5? Please give me sample code.
Thanks in advance for your help.
Kind Regards
Alfaz
One way is to set the data to null value
Hello. But what about a datawindow showing some records which one field is a raddio button with only one value to choose? For example a survey with multi-optional questions: a question could have 4, 5, or more options to choose ( every option text is a record in a database table), and once an option is selected, the others options in the same question should be deselected automatically. How to include a raddiobutton style but only with one display value: Y? Thanks in advance.
set edit style for all those data items to radiobuttons and put them in one group
In PB12 the 2D look is no longer available, any thoughts on how we can achieve the same thing in PB12 ?
to get 2d look for radibuttons in PB12, use dw.modify(“control.RadioButtons.3d=No”)
to get 2d look for radibuttons in PB12, set dw.object.control.RadioButtons.3d=”No”