Subject: Plug-in to recreate the run-time custom field section in its own tab?
Prev Next
You are not authorized to post a reply.

Author Messages
Andy JUser is Offline

Posts:4

09/08/2008 12:47 AM  
Hi
I am having some difficulties in getting my head round data binding.
As my customisation is relatively simple but does involve lots of fields I thought of  a simple solution...

I would quite simply like to add several custom fields to a dedicated tab in the header of the Supplier Form (alongside the General, Setup, Contact... tabs). The Run time custom field section is too small on the General tab.
Is there some way of creating a plug-in to move the run-time custom field section from the General tab to its own tab? In that way there will be plenty of room to add lots of fields in their own tab groups.   
Any help would be greatly appreciated.
Thanks

Andy
John Boaz LUser is Offline

Posts:18

09/09/2008 5:17 PM  
Good Day Andy,

I believe you should be able to do that by reusing the control that holds the custom fields in the General tab. You can find it at this namespace : Interprise.Presentation.Component.SharedControl.CustomFieldControl.

John Boaz T. Lee
Developer
Interprise Solutions
Andy JUser is Offline

Posts:4

09/10/2008 7:13 AM  
Hi John
 
Thanks for the hint.
I created a new solution and Created a new plugin section using the Interprise Recipe menu on the Presentation layer. I then added the Interprise CustomFieldControl from the toolbox but VS2005 threw the following error:
"The designer loader did not provide  a root component but has not indicated why"
 
Could you talk me through how to create a Custom Field Section Plugin? Thanks very much in advance for your help.
 
Andy :-)
Andy JUser is Offline

Posts:4

09/10/2008 7:15 AM  
Hi John
 
Thanks for the hint.
I created a new solution and Created a new plugin section using the Interprise Recipe menu on the Presentation layer. I then added the Interprise CustomFieldControl from the toolbox but VS2005 threw the following error:
"The designer loader did not provide  a root component but has not indicated why"
 
Could you talk me through how to create a Custom Field Section Plugin?
I'm afraid I am still new to the program and am still grappling... !
Thanks very much in advance for your help.
 
Andy :-)
Pete Ian AUser is Offline

Posts:26

09/10/2008 8:04 PM  
Hi,

You can't just create a custom field section for general purpose. You have to create a custom field section for specific form, because you have to identify also the datasetgateway of that form and his parent parent control name.

Here the sample code we just created to have a custom plugin section on another tab.

Dim CustomerDetailControl_Control As Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl
Dim CustomerGateway As Interprise.Framework.Customer.DatasetGateway.CustomerDetailDatasetGateway

Try
CustomerDetailControl_Control = TryCast(Me.FindForm().Controls("PanelBody").Controls("CustomerDetailControl"), Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl)
Catch generatedExceptionName As System.Exception
End Try

' Did the object exist at the expected path?
If CustomerDetailControl_Control IsNot Nothing Then
' Use the reference here
CustomerGateway = DirectCast(CustomerDetailControl_Control, Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl).CustomerDataset
End If

Dim x As New Interprise.Presentation.Component.SharedControl.CustomFieldControl(CustomerGateway.CustomerView, "Customer")
x.Dock = DockStyle.Fill
Panel1.Controls.Add(x)

You insert this code under initializecontrol(). This custom field section is just for customer form detail. Like I said above you have to identify the datasetgateway and parent control. First I declare 2 variables for datasetgateway and parent control. Second I find the parent control form and place to my variable. Third I create a variable x and instanciate to custom field control with a paramenter of the used table or view on the dataset of this customer detail control and the table name. fourth dock and add to panel the instantiated variable.

I hope this could help.

Pete



Andy JUser is Offline

Posts:4

09/11/2008 5:21 AM  
Hi Pete

I greatly appreciate your assistance.
Unfortunately I keep getting errors. (Main problem for me is that the examples in the hands on examples and other documentation do not seem to have been upgraded to the latest release and of course I am not an expert !!)

This is what I am doing :
1. Create new solution for VB in Visual Studio using Interprise Plugin Factory guidance package
2. Give it my own Rootnamespace "AO" and Project Names "CustomerCFS"
3. Right-click on AO.Presentation.CustomerCFS and from the Interprise Plugin Factor menu select "Create Plugin Section"
4. Give the section the name "CustomerCFS"
5. Open the designer view of the newly created "CustomerCFSSection.vb"
6. I drag a DevEx PanelControl component onto the section
7. Having already selected to add the following item to the Toolbox "CustomFieldControl" (Namespace: Interprise.Presentation.Component.SharedControl), I drag the CustomFieldControl onto the PanelControl
8. Set Dock properties to Fill
9. Add your code here:
#Region " InitializeControl "
Protected Overrides Sub InitializeControl()

'YOUR CODE STARTS
Dim CustomerDetailControl_Control As Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl
Dim CustomerGateway As Interprise.Framework.Customer.DatasetGateway.CustomerDetailDatasetGateway

Try
CustomerDetailControl_Control = TryCast(Me.FindForm().Controls("PanelBody").Controls("CustomerDetailControl"), Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl)
Catch generatedExceptionName As System.Exception
End Try

' Did the object exist at the expected path?
If CustomerDetailControl_Control IsNot Nothing Then
' Use the reference here
CustomerGateway = DirectCast(CustomerDetailControl_Control, Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl).CustomerDataset
End If

Dim x As New Interprise.Presentation.Component.SharedControl.CustomFieldControl(CustomerGateway.CustomerView, "Customer")
x.Dock = DockStyle.Fill
Panel1.Controls.Add(x)
'YOUR CODE ENDS

'This call is required by the Presentation Layer.
MyBase.InitializeControl()

'Add any initialization after the InitializeControl() call

End Sub
#End Region

10. Right-click on AO.Presentation.CustomerCFS and select Build

The following ERRORS are produced:
error BC30002: Type 'Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl' is not defined.
error BC30002: Type 'Interprise.Framework.Customer.DatasetGateway.CustomerDetailDatasetGateway' is not defined.
error BC30002: Type 'Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl' is not defined.
error BC30002: Type 'Interprise.Presentation.Customer.CustomerDetail.CustomerDetailControl' is not defined.
error BC30451: Name 'Panel1' is not declared.

The following WARNING is produced:
Unable to find dependency 'C:\...\AO.Framework.CustomerCFS.dll' of project output 'Primary output from AO.Business.CustomerCFS (Active)'

I can ignore the errors and register the plugin add it to the Customer form as a new tab, but of course it can't see any custom fields when attempting to add fields!!

Where am I going wrong? I greatly appreciate any help as am keen to get my head around this. Thanks very much

Andy
John Boaz LUser is Offline

Posts:18

09/11/2008 6:33 PM  
Hi there Andy,

First let's start with the errors. Since Pete's sample revolved around the Customer form he was accessing controls found in Interprise.Presentation.Customer assembly/dll, you will have to add a reference of this to your plugin's presentation layer. With regards to Panel1 not being defined, note that the sample showed the CustomFieldControl being created dynamically and then docked onto a panel, so it is pretty safe to assume that a panel with the name Panel1 was placed onto the plugin section (dockstyle set to fill), and during run-time the created CustomFieldControl was then added onto the panel control.

Additionally, since I believe you want to access the Supplier Detail Form you'd have to make several amendments to the sample for it to work on Supplier Form.

Dim SupplierDetailControl As Interprise.Presentation.Supplier.SupplierDetails.MainControl
Dim SupplierrGateway As Interprise.Framework.Base.DataSetGateway.Supplier.SupplierDetailDataSetGateway

Try
SupplierDetailControl = TryCast(Me.FindForm().Controls("PanelBody").Controls("MainControl"), Interprise.Presentation.Supplier.SupplierDetails.MainControl)
Catch generatedExceptionName As System.Exception
End Try

'Did the object exist at the expected path?
If SupplierDetailControl IsNot Nothing Then
' Use the reference here
SupplierGateway = DirectCast(SupplierDetailControl, Interprise.Presentation.Supplier.SupplierDetails.MainControl).CurrentDataset
End If


Dim x As New Interprise.Presentation.Component.SharedControl.CustomFieldControl(SupplierGateway.SupplierView, "")
x.Dock = DockStyle.Fill
Panel1.Controls.Add(x)

Remember to add the panel onto your section during design-time and to reference interprise.presentation.supplier

John Boaz T. Lee
Developer
Interprise Solutions
John Boaz LUser is Offline

Posts:18

09/11/2008 6:37 PM  
I wrote the amendments from memory and there are some typographical errors so don't take it as it is, just a general idea as to what you should do. Hope you get it up and running soon.

John Boaz T. Lee
Developer
Interprise Solutions
You are not authorized to post a reply.
Forums > Connected Business Platform > Source Code Questions > Plug-in to recreate the run-time custom field section in its own tab?



ActiveForums 3.7
Privacy Statement  |  Terms Of Use
Interprise Software Systems International Inc.