Page 1 of 1

Sample Code Request for Jiwa Forms Standardisation

PostPosted: Mon Sep 01, 2014 7:17 pm
by jiwameister
Hi,

We would like to convert our existing IP into Jiwa 7, some of these projects requires new forms to be created within Jiwa.

We would like to have these forms look and feel (and work) like standard Jiwa forms. Do you have a template form or a sample project that you might use as a template for creating standard Jiwa Forms?

In particular, we are interested in creating the same look and feel for grids, tabs etc.

Thanks

Re: Sample Code Request for Jiwa Forms Standardisation  Topic is solved

PostPosted: Tue Sep 02, 2014 10:38 am
by Mike.Sheen
jiwameister wrote:We would like to have these forms look and feel (and work) like standard Jiwa forms. Do you have a template form or a sample project that you might use as a template for creating standard Jiwa Forms?

In particular, we are interested in creating the same look and feel for grids, tabs etc.



At this moment we don't have a sample, but some of the sample plugins in the demo data do create their own forms styled in the same manner.

If your form inherits from our base form types, then you will get the ribbon and styling. The 4 main type of forms are:
  • JiwaFinancials.Jiwa.JiwaApplication.Maintenance.UserInterface
  • JiwaFinancials.Jiwa.JiwaApplication.ListMaintenance.UserInterface
  • JiwaFinancials.Jiwa.JiwaApplication.ProcessAction.UserInterface
  • JiwaFinancials.Jiwa.JiwaApplication.MultiListMaintenance.UserInterface

As well as the styling, you'll get automatic persistence of the form dock state, size and location.

As for the grids and tabs - use a JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaGrid control for the grid and it will be styled appopriately. For tabs, use a JiwaFinancials.Jiwa.JiwaApplication.Controls.JiwaTabControl.

When initialising / setting up a JiwaGrid control, be sure to call SetupComplete after adding the required columns. For example:

Code: Select all
        With grdContactNames
            .AddColumn("Key", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaTextCellType, "Key", 0, True, False, True, True)
            .AddColumn("ItemNo", New CellType.NumberCellType, "Item No.", 5, , , , True)
            .AddColumn("Title", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaTextCellType, "Title", 10, , , True, , 30)
            .AddColumn("FirstName", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaTextCellType, "First Name", 10, , , True, , 50)
            .AddColumn("Surname", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaTextCellType, "Surname", 10, , , True, , 50)
            .AddColumn("Phone", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaTextCellType, "Phone", 10, , , True, , 20)
            .AddColumn("Debtor", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaTextCellType, "Debtor", 10, , , True, True, 50)
            .AddColumn("DebtorLookupButton", New JiwaFinancials.Jiwa.JiwaApplication.JiwaManageGrid.JiwaLookupButtonCellType, "")
            .AddColumn("Bin", New JiwaBinButtonCellType, "")
            .SetupComplete()
        End With


If the form the grid is on inherits from one of the 4 types I mentioned earlier, then your grid will get automatic persistence of the custom column information.

I'll put up some samples over the next few days to show in more detail what I've outlined above.

Mike

Re: Sample Code Request for Jiwa Forms Standardisation

PostPosted: Fri Sep 26, 2014 6:37 pm
by perry
Hi Mike,

Can you provide us some sample codes on this topic please?

So far, I have a maintenance form (Inherits JiwaFinancials.Jiwa.JiwaApplication.Maintenance.UserInterface),
Code: Select all
Namespace UI
    Public Class frmOrder
        Inherits JiwaFinancials.Jiwa.JiwaApplication.Maintenance.UserInterface

        Public Overrides Sub Setup()
            MyBase.Setup()
        End Sub
       
    End Class
End Namespace


a business logic class (Inherits JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.Maintenance)
Code: Select all
Namespace BL

    Public Class Order
        Inherits JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.Maintenance


        Public Overrides Sub Clear()

        End Sub

        Public Overrides Sub Copy()

        End Sub

        Public Overrides Sub CreateNew()

        End Sub

        Public Overrides Sub Delete()

        End Sub

        Public Overrides Sub Deserialise(XMLString As String)

        End Sub

        Public Overrides Sub Read(RecID As String)

        End Sub

        Public Overrides ReadOnly Property RecIDFieldName As String
            Get

            End Get
        End Property

        Public Overrides Sub Serialise(ByRef XML As String)

        End Sub

        Public Overrides Sub Setup()

        End Sub

        Public Overrides ReadOnly Property SortFieldValue As String
            Get

            End Get
        End Property

        Public Overrides ReadOnly Property TableName As String
            Get

            End Get
        End Property
    End Class

End Namespace



Without any codes, I can compile the the DLL, include the form in form maintenance and include in the menu, however, it fails in Setup().
I'm assuming there are properties I need to initialize.

Re: Sample Code Request for Jiwa Forms Standardisation

PostPosted: Tue Sep 30, 2014 12:15 pm
by Mike.Sheen
perry wrote:Hi Mike,

Can you provide us some sample codes on this topic please?


Here's the Supplier Return Request form code (attached). It should provide enough of a template to get you going.

Request.zip
Supplier Returns Request form
(12.46 KiB) Downloaded 188 times


Mike

Re: Sample Code Request for Jiwa Forms Standardisation

PostPosted: Wed Oct 01, 2014 2:16 pm
by perry
Hi Mike,

I'm still building the UI and it's business logic and came a cross 1 issue so far I don't understand why.

Whenever "Cancel" button from menu is clicked, the form gets deactivated and showdown itself. It doesn't seem to be calling any public methods from Business object class...

it will be great if you know what is wrong without seeing my code. Otherwise, I will continue my work here, gather more questions and ask you in 1 go with sample codes/data.

Regards,

Re: Sample Code Request for Jiwa Forms Standardisation

PostPosted: Fri Oct 03, 2014 3:13 pm
by Mike.Sheen
perry wrote:Whenever "Cancel" button from menu is clicked, the form gets deactivated and showdown itself. It doesn't seem to be calling any public methods from Business object class...

it will be great if you know what is wrong without seeing my code. Otherwise, I will continue my work here, gather more questions and ask you in 1 go with sample codes/data.

Regards,


Hi Perry,

If you're inheriting from our Maintenance.UserInterface class then you will see that behaviour of the form closing when clicking cancel upon certain conditions. We decided if a maintenance form was being opened and there was no initial record to read (eg: empty database or a filter resulting in no initial record), then we put the business logic into new mode immediately. If the user clicks cancel under these conditions, we close the form as that seems most appropriate.

To make this not happen, you need to make sure your business logic RecID property is set to something at the conclusion of your Read method. If you don't have anything to read - then the user clicking cancel should close the form. This is how all our maintenance forms function in version 7.

Mike

Re: Sample Code Request for Jiwa Forms Standardisation

PostPosted: Tue Oct 07, 2014 12:57 pm
by perry
/dance

To make this not happen, you need to make sure your business logic RecID property is set to something at the conclusion of your Read method.


That's it, thanks!