
Toolbox Frame
A Frame control in an InForm application serves as a container for other controls. This page provides more detailed information about Frame controls
Frame control
Create a new Frame control by clicking the Frame icon in the Toolbox. The newly created control will be displayed in the preview window; allowing you to move it around to meet your design requirements. Edit the Frame properties as necessary.
12) Frame Properties:

Frame example: Preview window.

Note: Frame box properties will reflect the highlighted control selected in the preview window, enabling you to customize it as needed.
A Frame control serves as a container for other controls.
Design time:
At design time, drag controls into a frame, and they will be automatically grouped. You can select a frame and insert a control from the Toolbox. Additionally, you can use cut, copy, and paste controls into a selected frame.
Frame examples - refer to the above image.
Specification: Let the frame examples have the following design specification:
- Add two groups, one containing four radio buttons and the other three radio buttons.
- Label the groups and radio buttons as shown.
- The start button displays a pop-up displaying radio buttons selected.
- At start-up, select the first radio button in each group (you could have done this at design time).
Implimenation: The following provide solutions for the above:
- At runtime, use the subroutine __UI_OnLoad and the method SetRadioButtonValue to set selections.
- Button click: use the subroutine __UI_Click.
- For additional details, check out the file FrameExample.bas
- At the layout stage, save the project using File -> Save project as and enter the name FrameExample.
- Use the function _MessageBox to display the buttons selected.
SetRadioButtonValue ControlID
Basic file FrameExample.bas
': This program uses
': InForm - GUI library for QB64 - v1.5
': Fellippe Heitor, 2016-2024 - fellippe@qb64.org - @fellippeheitor
': https://github.com/FellippeHeitor/InForm
'-----------------------------------------------------------
Option _Explicit ' <---
Dim Shared weatherSelected As String ' <---
Dim Shared difficultySelected As String ' <---
Dim Shared resultStr As String ' <---
': Controls' IDs: ------------------------------------------------------------------
Dim Shared Form1 As Long
Dim Shared sunnyRB As Long
Dim Shared cloudyRB As Long
Dim Shared foggyRB As Long
Dim Shared rainyRB As Long
Dim Shared easyRB As Long
Dim Shared IcanHandleRB As Long
Dim Shared struggleRB As Long
Dim Shared Frame1 As Long
Dim Shared Frame2 As Long
Dim Shared startBT As Long
Dim Shared Label1 As Long
': External modules: ---------------------------------------------------------------
'$INCLUDE:'InForm\InForm.bi'
'$INCLUDE:'InForm\xp.uitheme'
'$INCLUDE:'FrameExample.frm'
': Event procedures: ---------------------------------------------------------------
Sub __UI_BeforeInit
End Sub
Sub __UI_OnLoad
SetRadioButtonValue sunnyRB ' <---
SetRadioButtonValue easyRB ' <---
End Sub
Sub __UI_BeforeUpdateDisplay
'This event occurs at approximately 60 frames per second.
'You can change the update frequency by calling SetFrameRate DesiredRate%
End Sub
Sub __UI_BeforeUnload
'If you set __UI_UnloadSignal = False here you can
'cancel the user's request to close.
End Sub
Sub __UI_Click (id As Long)
Select Case id
Case Form1
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case Frame1
Case Frame2
Case startBT
resultStr = "Weather selected = " + weatherSelected + Chr$(10) ' <---
resultStr = resultStr + "Difficulty selected = " + difficultySelected ' <---
_MessageBox "Frame test", resultStr ' <---
Case Label1
End Select
End Sub
Sub __UI_MouseEnter (id As Long)
Select Case id
Case Form1
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case Frame1
Case Frame2
Case startBT
Case Label1
End Select
End Sub
Sub __UI_MouseLeave (id As Long)
Select Case id
Case Form1
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case Frame1
Case Frame2
Case startBT
Case Label1
End Select
End Sub
Sub __UI_FocusIn (id As Long)
Select Case id
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case startBT
End Select
End Sub
Sub __UI_FocusOut (id As Long)
'This event occurs right before a control loses focus.
'To prevent a control from losing focus, set __UI_KeepFocus = True below.
Select Case id
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case startBT
End Select
End Sub
Sub __UI_MouseDown (id As Long)
Select Case id
Case Form1
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case Frame1
Case Frame2
Case startBT
Case Label1
End Select
End Sub
Sub __UI_MouseUp (id As Long)
Select Case id
Case Form1
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case Frame1
Case Frame2
Case startBT
Case Label1
End Select
End Sub
Sub __UI_KeyPress (id As Long)
'When this event is fired, __UI_KeyHit will contain the code of the key hit.
'You can change it and even cancel it by making it = 0
Select Case id
Case sunnyRB
Case cloudyRB
Case foggyRB
Case rainyRB
Case easyRB
Case IcanHandleRB
Case struggleRB
Case startBT
End Select
End Sub
Sub __UI_TextChanged (id As Long)
Select Case id
End Select
End Sub
Sub __UI_ValueChanged (id As Long)
Select Case id
Case sunnyRB
weatherSelected = "Sunny" ' <---
Case cloudyRB
weatherSelected = "Cloudy"
Case foggyRB
weatherSelected = "Foggy"
Case rainyRB
weatherSelected = "Rainy"
Case easyRB
difficultySelected = "Easy"
Case IcanHandleRB
difficultySelected = "I can handle this"
Case struggleRB
difficultySelected = "Make me struggle"
End Select
End Sub
Sub __UI_FormResized
End Sub
'$INCLUDE:'InForm/InForm.ui'
Form file FrameExample.frm
': This form was generated by
': InForm - GUI library for QB64 - v1.5
': Fellippe Heitor, 2016-2024 - fellippe@qb64.org - @fellippeheitor
': https://github.com/FellippeHeitor/InForm
'-----------------------------------------------------------
SUB __UI_LoadForm
DIM __UI_NewID AS LONG, __UI_RegisterResult AS LONG
__UI_NewID = __UI_NewControl(__UI_Type_Form, "Form1", 300, 300, 0, 0, 0)
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Frame Example"
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 12)
Control(__UI_NewID).HasBorder = False
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "Frame1", 104, 176, 18, 85, 0)
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Weather"
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).BorderSize = 1
__UI_NewID = __UI_NewControl(__UI_Type_Frame, "Frame2", 154, 122, 136, 85, 0)
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Difficulty level"
Control(__UI_NewID).HasBorder = True
Control(__UI_NewID).BorderSize = 1
__UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "sunnyRB", 77, 23, 20, 15, __UI_GetID("Frame1"))
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Sunny"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "cloudyRB", 77, 23, 20, 56, __UI_GetID("Frame1"))
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Cloudy"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "foggyRB", 77, 23, 20, 97, __UI_GetID("Frame1"))
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Foggy"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "rainyRB", 77, 23, 20, 138, __UI_GetID("Frame1"))
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Rainy"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "easyRB", 124, 23, 9, 15, __UI_GetID("Frame2"))
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Easy"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "IcanHandleRB", 125, 23, 9, 49, __UI_GetID("Frame2"))
__UI_RegisterResult = 0
SetCaption __UI_NewID, "I can handle this"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_RadioButton, "struggleRB", 125, 23, 9, 83, __UI_GetID("Frame2"))
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Make me struggle"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Button, "startBT", 80, 23, 136, 232, 0)
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Start"
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).CanHaveFocus = True
__UI_NewID = __UI_NewControl(__UI_Type_Label, "Label1", 150, 36, 18, 24, 0)
__UI_RegisterResult = 0
SetCaption __UI_NewID, "Game settings"
Control(__UI_NewID).Font = SetFont("segoeui.ttf", 23)
Control(__UI_NewID).HasBorder = False
Control(__UI_NewID).VAlign = __UI_Middle
END SUB
SUB __UI_AssignIDs
Form1 = __UI_GetID("Form1")
sunnyRB = __UI_GetID("sunnyRB")
cloudyRB = __UI_GetID("cloudyRB")
foggyRB = __UI_GetID("foggyRB")
rainyRB = __UI_GetID("rainyRB")
easyRB = __UI_GetID("easyRB")
IcanHandleRB = __UI_GetID("IcanHandleRB")
struggleRB = __UI_GetID("struggleRB")
Frame1 = __UI_GetID("Frame1")
Frame2 = __UI_GetID("Frame2")
startBT = __UI_GetID("startBT")
Label1 = __UI_GetID("Label1")
END SUB