KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Creating Radio Buttons (version 6.0.x and 6.5.x)
PRODUCT: 4D | VERSION: 6.0 | PLATFORM: Mac & Win
Published On: May 5, 2000

In 4D, radio buttons are created by placing Radio button objects side by side and by respecting some naming conventions.

To create a radio button:

1. Select the Radio button tool from the Tools palette in the form editor.

2. Draw a radio button on the form.

3. Copy and paste that object as many times as necessary.

4. Assign names to these Radio buttons objects according to the following:

The first part of the radio button object names must be identical within the same set of radio buttons (rButton1, rButton2, rButton3 and so on). If you want to use several sets of radio buttons in the same form, you should make sure their names do not start with the same letter (rButton1, rButton2… and sButton1, sButton2 etc.).

Once you have created the radio buttons, if you display the form in the user environment, clicking one choice will deactivate any that is already selected.

If you want to set a default value for the radio button when the form is loaded, select the On Load event and put the following code in the form method:

Here is a text version of this code for you to cut and paste into your own project:

Case of
: (Form event=On Load)
rButton1:=1
End case