Xojo2023r3 WebRadioGroup

Is there a demo showing how to work with WebRadioGroup?
I need to see how to apply labels to the radio button dynamically when opening the WebDialog page that has the WebRadioButton group. I need to know which button is selected.

In the inspector there is an Initial value. Click the pencil next to it and edit the Radtiobuttons. There is also a switch for making the group horizontal. You can also use:

WebRadtioGroupName.ItemAt( 0 ).Caption = "My New Text"
WebRadtioGroupName.ItemAt( 1 ).Caption = "second button"

The documentation is your friend.

https://documentation.xojo.com/api/user_interface/web/webradiogroup.html#webradiogroup

It has a SelectedIndex property you can check, and also has a SelectedItem event raised when the selection changes.

This commented code works in Xojo2018:
//HistoryOptionRadioButton.CellCaption(0, 0) = “Last 7 Days”
//HistoryOptionRadioButton.CellCaption(0, 1) = “All”

As you can see there are two parameters specifying row and column (0,1).

In Xojo2023r3 this will not work. I have substituted them like this:
Var vLast7DaysRdi As New WebRadiobutton(“Last 7 Days”, True)
vLast7DaysRdi.Tag = “Last7Days”
Me.Add(vLast7DaysRdi)

Var vAllRdi As New WebRadiobutton(“All”, True)
vAllRdi.Tag = “All”
Me.Add(vAllRdi)

This seems to work but I am not sure if this is the right way to do. Also I will need to determine which option is selected. How should I go about it?

You need to discard everything you know about Web 1 when using Web 2.
The recommendation from Xojo is to build a whole new project.

Well, I don’t mind discarding everything as long as I get the demo/sample/explanation how to make things work. I do understand the limitations on my end but I need something to learn from. Googling around is not giving me what I need to know, at least for now.

WebRadioGroup can only be horizontal or vertical, not both. If you want a grid you need more than one Group.

Have you looked into the examples?

I don’t need the grid, all I need is horizontal for this scenario. One thing that I need to know is how to address the web radio button to change its caption (aka label) dynamically (the caption may be different each time as the web dialog with this radio button is used by more than one web page). I can’t find any example showing how to change the caption via code. It would be appreciate if someone can tell me how to do it. If it is possible that is. I am sure this is simple, it is just that I don’t know how to do it just yet.

I posted that above. Get the ItemAt from the group, then set the caption. 0 is the first RadioButton, 1 the second etc.

Great, thanks, this is what I have:

Xojo2018
//HistoryOptionRdiGroup.CellCaption(0, 0) = vCaption1
//HistoryOptionRdiGroup.CellCaption(0, 1) = vCaption2

Xojo2023r3
HistoryOptionRdiGroup.ItemAt(0).Caption = vCaption1
HistoryOptionRdiGroup.ItemAt(1).Caption = vCaption2

where vCaption1, vCaption2 have the relevant string values.

Tim thank you, it turned out that I have learned something from the article after all - I looked at Project > Analysis Warnings menu in IDE and found this:

“LateReasonDialog.HistoryOptionRdiGroup.SelectionChanged Declaration
button is an unused method parameter
Sub SelectionChanged(button As WebRadioButton)”

So I have figured that I can use “button.Tag” to test the tag value in the code.