RADIOBUTTONCREATE

Synopsis
RADIOBUTTONCREATE parent group name label xpos ypos width height
Description

Creates a radio button control. A radio button control is used to give the user a selection of a two state (TRUE or FALSE) item. But along with this is a restriction that only one radio button within a group box can be set to TRUE at any given time. A radio button must be associated with a group box control (see GROUPBOXCREATE).

The parent input is the name of the window that owns the new radio button. If no window or dialog with that name exists, then the FMSLogo screen window is used as the parent.

The group input is the name of the group box control to associate with the new radio button control. All radio buttons within the same group box must be created one after another, without creating any other controls on the same parent in between.

The name input identifies the new radio button and must be a unique word.

The label input is a word that is written next to the radio button.

The xpos input is the X coordinate where the upper-left corner of the new radio button is placed.

The ypos input is the Y coordinate where the upper-left corner of the new radio button is placed.

The width input is the width of the new radio button.

The height input is the height of the new radio button.

If the parent of the radio button is the FMSLogo screen window, then the xpos, ypos, width, and height inputs are all given in turtle coordinates. Otherwise, they are given in "dialog units", the origin is the upper-left corner of the parent, and Y values increase as you move down the screen.

Example

Create radio buttons in a new window:

TO CHECKONTHINGS
  IFELSE RADIOBUTTONGET "myhideturtle [HIDETURTLE] [SHOWTURTLE]
END

WINDOWCREATE "main "mywindow "mytitle 0 0 100 100 []
GROUPBOXCREATE "mywindow "mygroupbox 10 5 80 60
RADIOBUTTONCREATE "mywindow "mygroupbox "myhideturtle [Hide Turtle] 20 15 60 20
RADIOBUTTONCREATE "mywindow "mygroupbox "myshowturtle [Show Turtle] 20 35 60 20
RADIOBUTTONSET "myhideturtle "true
RADIOBUTTONSET "myshowturtle "false
BUTTONCREATE "mywindow "mybutton "Go 40 70 25 15 [CHECKONTHINGS]

; Delete the window and all of its child controls.
WINDOWDELETE "mywindow

Create a radio button on the FMSLogo screen window:

TO CHECKONTHINGS
  IFELSE RADIOBUTTONGET "myhideturtle [HIDETURTLE] [SHOWTURTLE]
END

GROUPBOXCREATE "main "mygroupbox 110 130 140 100
RADIOBUTTONCREATE "main "mygroupbox "myhideturtle [Hide Turtle] 120 120 120 40
RADIOBUTTONCREATE "main "mygroupbox "myshowturtle [Show Turtle] 120 80 120 40
RADIOBUTTONSET "myhideturtle "true
RADIOBUTTONSET "myshowturtle "false
BUTTONCREATE "main "mybutton "Go 160 20 50 50 [CHECKONTHINGS]

; Delete all windows.
WINDOWDELETE "main

See Also
RADIOBUTTONDELETE
RADIOBUTTONGET
RADIOBUTTONSET
RADIOBUTTONENABLE

SourceForge.net Logo