Posted 15 December 2020, 12:31 am EST
Hi Ruchir,
In the included example:
- When the sub editor is “opened” while the sheet current row is the second row (row 1) the SetValue requests and receives the current row’s item by raising the the requestWsItem event.
- The itbNote.Text property is loaded with the item.note “Note 2” value. The irb1 (InputRadioButton) and the rb1 (RadioButton) are checked since the item.Index is 1.
- The user moves to the third row on the sheet and clicks the down arrow on the second column and receives the current row’s item by raising the the requestWsItem event. open the sub editor.
- The itbNote.Text property is loaded with the correct item.note “Note 3” value. The irb2 (InputRadioButton) and the rb2 (RadioButton) are checked since the item.Index is 2. When the subeditor is displayed, irb2 is NOT the checked radio button.
If you replace the code in ucSubEditor with:
Imports C1.Win.C1InputPanel
Imports FarPoint.Win.Spread.CellType
Public Class ucSubEditor
Implements ISubEditor
Public Property item As classItem
Public Event ValueChanged As EventHandler Implements ISubEditor.ValueChanged
Public Event CloseUp As EventHandler Implements ISubEditor.CloseUp
Public Event requestWsItem As EventHandler(Of classItem)
#Region "iSubEditor"
Public Sub SetValue(value As Object) Implements ISubEditor.SetValue
RaiseEvent requestWsItem(Me, item)
itbNote.Text = item.note
Console.WriteLine("item.index:{0}", item.index)
Select Case item.index
Case 0
irb0.Checked = True
rb0.Checked = True
Case 1
irb1.Checked = True
rb1.Checked = True
Case 2
irb2.Checked = True
rb2.Checked = True
End Select
End Sub
Private Sub irb_CheckedChanged(sender As Object, e As EventArgs) Handles irb0.CheckedChanged,
irb1.CheckedChanged,
irb2.CheckedChanged
Dim irb = CType(sender, InputRadioButton)
Console.WriteLine("irb{0} checked:{1}", irb.Name, irb.Checked)
End Sub
Public Function GetValue() As Object Implements ISubEditor.GetValue
item.index = irb0.SelectedIndex
item.note = itbNote.Text
Return Nothing
End Function
Public Function GetSubEditorControl() As Control Implements ISubEditor.GetSubEditorControl
Return Me
End Function
Public Function _GetPreferredSize() As Size Implements ISubEditor.GetPreferredSize
Return New Size(240, 300)
End Function
Public Function GetLocation(rect As Rectangle) As Point Implements ISubEditor.GetLocation
End Function
#End Region
End Class
. . . you will notice that irb1 is getting checked (I don’t know why and by what) after irb2 is checked programmatically.
In the example, the RadioButtons are behaving correctly, the InputRadioButtons are not.
-Kingman
I am using the latest versions of Spread (14.45.20201.0) and C1 (4.5.2)