on 01-06-2005 4:34 AM
Hi all,
I've got a UDO with only a header with 2 fields: Code and Name. I've created my form and added a matrix and 2 buttons and linked the form to the UDO. But when I load the code, even if there is some data in my UDO, they don't appear in my matrix. Any idea?
Another problem is that the button 1 and button 2 don't appear...
Vincent
Option Explicit
Private WithEvents SBO_Application As SAPbouiCOM.Application
Private oCompany As SAPbobsCOM.Company
Public oForm As SAPbouiCOM.Form
Private Sub SetApplication()
Dim SboGuiApi As SAPbouiCOM.SboGuiApi
Dim sConnectionString As String
Set SboGuiApi = New SAPbouiCOM.SboGuiApi
sConnectionString = Command
SboGuiApi.Connect sConnectionString
Set SBO_Application = SboGuiApi.GetApplication()
End Sub
Private Function SetConnectionContext() As Long
Dim sCookie As String
Dim sConnectionContext As String
Dim lRetCode As Long
Set oCompany = New SAPbobsCOM.Company
sCookie = oCompany.GetContextCookie
sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie)
If oCompany.Connected = True Then
oCompany.Disconnect
End If
SetConnectionContext = oCompany.SetSboLoginContext(sConnectionContext)
End Function
Private Function ConnectToCompany() As Long
ConnectToCompany = oCompany.Connect
End Function
Private Sub Class_Initialize()
SetApplication
If Not SetConnectionContext = 0 Then
SBO_Application.MessageBox "Failed setting a connection to DI API"
End ' Terminating the Add-On Application
End If
If Not ConnectToCompany = 0 Then
SBO_Application.MessageBox "Failed connecting to the company's Data Base"
End ' Terminating the Add-On Application
End If
Dim creationPackage As SAPbouiCOM.FormCreationParams
Dim oForm As SAPbouiCOM.Form
Dim oItem As SAPbouiCOM.Item
Dim oButton As SAPbouiCOM.Button
Dim oMatrix As SAPbouiCOM.Matrix
Dim oColumn As SAPbouiCOM.Column
Dim oColumns As SAPbouiCOM.Columns
Set creationPackage = SBO_Application.CreateObject(cot_FormCreationParams)
creationPackage.UniqueID = "MathExamsID"
creationPackage.FormType = "SM_MathExam"
creationPackage.ObjectType = "EVOSS_OITG" '// set the parameter with the object unique id
creationPackage.BorderStyle = SAPbouiCOM.BoFormTypes.ft_Fixed
'Set oForm = SBO_Application.Forms.Add("EVOSS_FRM1", ft_Fixed)
Set oForm = SBO_Application.Forms.AddEx(creationPackage)
oForm.Title = "Item Grades"
oForm.Height = 300
oForm.Width = 350
oForm.DataSources.UserDataSources.Add "EVOSS_DS1", dt_SHORT_NUMBER, 1
Set oItem = oForm.Items.Add("1", it_BUTTON)
oItem.Left = 5
oItem.Width = 65
oItem.Top = 270
oItem.Height = 19
Set oButton = oItem.Specific
Set oItem = oForm.Items.Add("2", it_BUTTON)
oItem.Left = 75
oItem.Width = 65
oItem.Top = 270
oItem.Height = 19
Set oButton = oItem.Specific
'Adding a matrix
Set oItem = oForm.Items.Add("GradeList", it_MATRIX)
oItem.Left = 10
oItem.Width = 150
oItem.Top = 60
oItem.Height = 180
oItem.Description = ""
oItem.DisplayDesc = False
oItem.AffectsFormMode = True
Set oMatrix = oItem.Specific
'Adding the columns
Set oColumns = oMatrix.Columns
'Column 1
Set oColumn = oColumns.Add("Col_nb", it_EDIT)
oColumn.TitleObject.Caption = "#"
oColumn.Editable = False
oColumn.DataBind.SetBound True, "@EVOSS_OITG", "DocEntry"
'Column 2
Set oColumn = oColumns.Add("GradeCode", it_EDIT)
oColumn.TitleObject.Caption = "Grade Code"
oColumn.Editable = True
oColumn.DataBind.SetBound True, "@EVOSS_OITG", "Code"
'Column 3
Set oColumn = oColumns.Add("GradeDesc", it_EDIT)
oColumn.TitleObject.Caption = "Grade Code"
oColumn.Editable = True
oColumn.DataBind.SetBound True, "@EVOSS_OITG", "Name"
oForm.Mode = fm_FIND_MODE
oForm.Visible = True
End Sub
Hello Vincent,
If you want to show in a for only a matrix, you may consider of using the default form of the UDO, which is a matrix that contains the data. It's an option you have when you create the UDO.3
If you just start using the UDO, I'd recommend you to be familiar with them, to use text box instead of matrix.
In your form, add two text box and bind them to the fields, also add the
oForm.DataBrowser.BrowseBy = "Name of the control bind to Code field", that will allow you to browse it
I've created a UDO with matrix, but the matrix was linked to the table child, not the main table.
And there are some events to manage on the matrix child, the UDO won't do everything...
Sebastien
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried to set a breakpoint and stepped through the code... Not all errors from the SDK result in an exception, but just an abnormal exit from the event
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.