System setting file lookup  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

System setting file lookup

Postby pricerc » Mon Dec 17, 2018 2:34 pm

I'm wanting to add a file 'open' dialog to system settings, to provide a simple 'user-friendly' way to get a file name into a system setting.

I suppose the same logic would apply to a custom form field.

Any pointers/examples?
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21

Re: System setting file lookup  Topic is solved

Postby pricerc » Mon Dec 17, 2018 3:32 pm

To answer my own question:

Code: Select all
Public Class SystemSettingPlugin
      Inherits System.MarshalByRefObject
      Implements JiwaApplication.IJiwaSystemSettingPlugin
'.
'. bits left out that don't matter.
'.

        Public Sub ButtonClicked(ByVal BusinessLogicHost As JiwaApplication.IJiwaBusinessLogic, ByVal GridObject As JiwaApplication.Controls.JiwaGrid, ByVal FormObject As JiwaApplication.IJiwaForm, ByVal Col As Integer, ByVal Row As Integer, ByVal SystemSetting As JiwaApplication.SystemSettings.Setting) Implements JiwaApplication.IJiwaSystemSettingPlugin.ButtonClicked
'             If Debugger.IsAttached Then Debugger.Break()
            If SystemSetting.IDKey = "Invoice Email Report Filename" Then
                Dim newFileDialog As OpenFileDialog = New OpenFileDialog() With {
                    .FileName = SystemSetting.Contents,
                    .CheckFileExists = True,
                    .DefaultExt = "RPT",
                    .Filter = "Crystal Reports (*.RPT)|*.RPT|All Files (*.*)|*,*",
                    .Multiselect = False,
                    .RestoreDirectory = True,
                    .SupportMultiDottedExtensions = True,
                    .DereferenceLinks = True
                }
                If newFileDialog.ShowDialog() = DialogResult.OK Then
                    SystemSetting.Contents = newFileDialog.FileName
                End If
            End If
        End Sub

   End Class


There's probably fancier stuff that could be done, but this has worked for me.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 518
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 21


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 4 guests