Switching between WebContainerControls via RadioGroup

Hi, guys,

I am trying to find out how to switch between several WebContainers via a RadioGroup.

Please see the link below.
https://www.dropbox.com/s/xd6pxxyslujepmn/RadioGroup%20Project.xojo_binary_project?dl=0

Thank you in advance,

VK

The one you want visible
Visible = True

The others
Visible = False

propertises:
myActiveConainer as WebContainer

RadioGroup1:
myActiveConainer = new ContainerControl1
myActiveConainer.EmbedWithin(Self, 266, 20, 300,300)

I like dynamic loading WebContainer.

Hi,

How do I find which radiobutton in the radio group is selected?

Thank you,

VK

Check out the documentation at http://documentation.xojo.com/index.php/RadioGroup .

This code sample deals with two radio buttons.

Dim p As Pair

p = Me.SelectedCell
Select Case p.Left
Case 0 // Row 1
MsgBox(“You clicked the top button.”)
Case 1 // Row 2
MsgBox(“You clicked the bottom button.”)
End Select

It does not work if the number of radio buttons is more than two.

What class do I need to use instead of Pair

Beatrix Willius give you the answer. It works with any number of radio buttons. Please read the documentation first:

Radio Group

In the RadioGroup Mousedown event or in the SelectionChanged event place the following code:

ContainerControl11.visible = False
ContainerControl21.visible = False
ContainerControl31.visible = False
if me.CellValue(0,0) = True then
ContainerControl11.visible = True
elseif me.CellValue(1,0) = True then
ContainerControl21.visible = True
elseif me.CellValue(2,0) = True then
ContainerControl31.visible = True
end if

Thank you, Mariano.

Your code works, and I found a mistake in my code that uses Case(0) approach.

I’ve placed the ContainerControl11.Visible=True into the WebPage1 open event.

Now all works as expected.

Big thank you who responded to my post.

VK