PC SOFT

WINDEV的在线文档

  • Overview
  • Initializing the choice of a Radio Button control
  • Displaying a Radio Button control with no default option
  • Retrieving the option selected in a Radio Button control
  • Case of a Radio Button control that returns an integer
  • For a radio button that returns a value
  • Pre-filled SWITCH on the Radio Button controls
  • Modifying the caption of a Radio Button control
  • Case of Radio Button controls with sub-captions
  • Modifying the colors of the captions for the options found in a Radio Button control
  • Properties specific to the Radio Button controls
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Overview
WinDev, WebDev and WinDev Mobile allow you to handle a Radio Button control by programming. To do so, use the variable of the Radio Button control in the code.

Regardless of the type of radio button, each option can be associated with:

  • an integer. This integer can take a value from 1 to N, N being the total number of options found in the radio button. The first option is the option #1, the second option is the option #2, ... The options are numbered from top to bottom and from left to right.
  • WinDevWindows Store apps a specific returned value . This returned value is specified in the "Content" tab of the description window of the control.
WinDevWindows Store apps Using the numbering or the returned values?
The method for programming the radio buttons that return an integer differs from the method for programming the radio buttons that return a value. The benefit of using returned values is visible when inserting or moving an option in the radio button:
  • If the radio button returns an integer, inserting or moving an option in the radio button forces you to review the entire code for managing the value of the radio button (to manage the change of numbers).
  • If the radio button returns a specific value, inserting an option into the radio button only requires to take the new option into account. Moving an option requires no modification.

18版本和更高版本
WinDev Note: Several WLanguage functions are used to add, insert or delete options in a Radio Button control. See Functions for managing the Radio Button controls for more details.
18新版本
WinDev Note: Several WLanguage functions are used to add, insert or delete options in a Radio Button control. See Functions for managing the Radio Button controls for more details.
WinDev Note: Several WLanguage functions are used to add, insert or delete options in a Radio Button control. See Functions for managing the Radio Button controls for more details.

Initializing the choice of a Radio Button control
By default, the first option is selected when a Radio Button control is displayed.

To check an option of a Radio Button control:

  • if the Radio Button control returns an integer, use the following syntax:
    <Name of Radio Button> = <Option Subscript>
  • if the Radio Button control returns a specific value (in WinDev or WinDev Mobile only), use the following syntax:
    <Name of Radio Button> = <Option Value>

The selection of an option unchecks the option that is currently selected.

Note: If the control is associated with a data file item, the assignment is automatically performed by using:

See Linking a Radio Button control to an item for more details.

WinDevWindows Store apps

Displaying a Radio Button control with no default option

A Radio Button control is always positioned on a position (1 by default).

To display a Radio Button control with no default option, all you have to do is assign the initial value of the control to:

  • -1 for a Radio Button control that returns an integer,
  • "" (empty string) for a Radio Button control that returns a value.
Note: A Radio Button control with no default value cannot be accessed by TAB.

Example:

// Display the radio button without initial value
RADIO_MyRadioButton=-1
// or RADIO_MyRadioButton = ""

Retrieving the option selected in a Radio Button control

Case of a Radio Button control that returns an integer

To retrieve the subscript of the option selected in the Radio Button control, use the following syntax:

<Option Subscript> = <Name of Radio Button>

In this case, the <Option Subscript> parameter is an integer corresponding to the number of the selected option.

To find out the caption of the option selected in the Radio Button control, use the following syntax:

<Option caption> = <Name of radio button>[Name of radio button]..标签

Note: If the control is associated with a data file item, the entered value is automatically retrieved by using:See Linking a Radio Button control to an item for more details.

WinDevWindows Store apps

For a radio button that returns a value

To retrieve the value of the option selected in the radio button, use the following syntax:

<Option Value> = <Name of Radio Button>

In this case, the <Option Value> parameter is a character string corresponding to the returned value of the selected option.

Note: ..返回值 is also used to find out and modify the value returned by each option of the Radio Button control.

To retrieve the subscript of the selected option, a specific process must be performed. Example:

// Value returned by the selected option
Result1RADIO_TodaysDish
// Find the subscript of the selected option
Subscript整数型
I整数型
对于I1最优直到RADIO_TodaysDish..数目
如果RADIO_TodaysDishI】..返回值=Result1,那么SubscriptI
结束

To find out the caption of the option selected in the radio button, use the following syntax:

<Option Caption> = <Name of Radio Button>[Option Subscript]..标签

Note: If the control is associated with a data file item, the entered value is automatically retrieved by using:See Linking a Radio Button control to an item for more details.

18版本和更高版本

Pre-filled SWITCH on the Radio Button controls

When typing the SWITCH statement relative to a Radio Button control, the code editor automatically adds the CASE corresponding to the different options of the radio button. The caption of each option is automatically added in line comment.

Some examples:

  • Code for a radio button that returns an integer: typing "SWITCH RADIO_Title" in the code editor displays:
  • Code for a radio button that returns a value: typing "SWITCH RADIO_TodaysMenu" in the code editor displays:
18新版本

Pre-filled SWITCH on the Radio Button controls

When typing the SWITCH statement relative to a Radio Button control, the code editor automatically adds the CASE corresponding to the different options of the radio button. The caption of each option is automatically added in line comment.

Some examples:

  • Code for a radio button that returns an integer: typing "SWITCH RADIO_Title" in the code editor displays:
  • Code for a radio button that returns a value: typing "SWITCH RADIO_TodaysMenu" in the code editor displays:

Pre-filled SWITCH on the Radio Button controls

When typing the SWITCH statement relative to a Radio Button control, the code editor automatically adds the CASE corresponding to the different options of the radio button. The caption of each option is automatically added in line comment.

Some examples:

  • Code for a radio button that returns an integer: typing "SWITCH RADIO_Title" in the code editor displays:
  • Code for a radio button that returns a value: typing "SWITCH RADIO_TodaysMenu" in the code editor displays:

Modifying the caption of a Radio Button control
..标签 is used to:
  • change the caption of the Radio Button control:
    <Name of Radio Button>..标签 = <Caption>
  • change the caption of all the options found in the Radio Button control:
    The options must be separated by the TAB character.
    You have the ability to specify the first options only.
    <Name of Radio Button>..标签 = <Option 1>+TAB+<Option 2>+TAB+<Option 3> ...
  • retrieve and modify the caption of an option:
    // Retrieve the sub-caption
    <Sub-caption> = <Name of radio button>[<Option subscript>]..副标签

    // Modify the sub-caption
    <Name of radio button>[<Option subscript>]..副标签 = <New sub-caption>

WinDevWindows Store apps

Case of Radio Button controls with sub-captions

..副标签 is used to find out and modify the sub-captions of the options found in a Radio Button control.

// Retrieve the sub-caption
<Sub-caption> = <Name of radio button>[<Option subscript>]..副标签

// Modify the sub-caption
<Name of radio button>[<Option subscript>]..副标签 = <New sub-caption>

Modifying the colors of the captions for the options found in a Radio Button control
WinDev To modify the colors of the captions for the options found in a Radio Button control, use the following syntax:

<Control name>..标签 = 图示画笔(<Color of option 1>) + ...
<Caption of option 1> + TAB + ...
图示画笔(<Color of Option N>) + <Caption of Option N>
<Color of Option> corresponds to:

Properties specific to the Radio Button controls
The following properties are used to manage the characteristics of a Radio Button control by programming.
水平对齐Used to find out and modify the horizontal alignment of a control.
垂直对齐Used to find out and modify the vertical alignment of a control.
颜色Used to find out and modify the color of the text for the options found in the Radio Button control.
背景颜色Used to find out and modify the background color of the Radio Button control.
列数Used to find out the number of columns in a Radio Button control.
数目Used to find out the number of options in a Radio Button control.
副标签Used to find out and modify the sub-caption of an option found in a Radio Button control.
初始值Used to find out the initial value of a Radio Button control.
返回值Used to find out and modify the value returned by an option found in a Radio Button control.

To find out the entire list of WLanguage properties that can be used with a Radio Button control, see Properties associated with a Radio Button control.