- Code: Select all
Public Sub ButtonClicked(ByVal BusinessLogicHost As IJiwaBusinessLogic, ByVal GridObject As Controls.JiwaGrid,
ByVal FormObject As IJiwaForm,
ByVal Col As Integer, ByVal Row As Integer,
ByVal SystemSetting As JiwaApplication.SystemSettings.Setting) Implements IJiwaSystemSettingPlugin.ButtonClicked
If Debugger.IsAttached Then Debugger.Break()
Dim activeSheet As FarPoint.Win.Spread.SheetView = GridObject.ActiveSheet
Dim activeCell As FarPoint.Win.Spread.Cell = activeSheet.Cells(Row, Col)
If String.Compare(SystemSetting.IDKey, "ReportName", StringComparison.InvariantCultureIgnoreCase) = 0 Then
Dim reportSearch As clsSearch = BusinessLogicHost.Manager.Search
reportSearch.Clear()
reportSearch.SetDefaultSearch(clsSearch.SearchModes.jswReports)
reportSearch.Caption = "Reports"
If (reportSearch.Show(FormObject.Form) <> System.Windows.Forms.DialogResult.OK) OrElse (reportSearch.Results.Count <> 1) Then
Return
End If
' 1 == first result (Because 1-based array returned from legacy dialog)
' 4 == field # for file name in search (potential breaking change with future versions.
Dim reportFileName = CStr(reportSearch.Result(1).Fields(4).FieldValue)
SystemSetting.Contents = reportFileName
End If
End Sub
I'm not crazy about the hard-coded '4', but in the debugger (as far as I can tell), the alternative is a hard-coded "File Name4", which seemed just as bad.