on 11-30-2004 2:24 PM
Hi there,
We want to use a LinkedButton within a Matrix Cell,
but can't find any CodeSample in UI Help.
Where can i get a Code Sample for adding a LinkedButton
to a Matrix Cell.
Thanks Thomas
Here you have a sample showing how to create a column with a linked button inside:
Dim oColumn As SAPbouiCOM.Column
Dim oLink As SAPbouiCOM.LinkedButton
'// Add a column of type LinkedButton (the text and the linked button will be in the same column)
oColumn = oColumns.Add("BPCardCode", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
oColumn.TitleObject.Caption = "Card Code"
oColumn.Width = 40
oColumn.Editable = True
'// Link the column to the BP master data type
oLink = oColumn.ExtendedObject
oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
'// Bind the column to a datasource containing the key of the object you link to
'// not mandatory, you can enter the information using UserDataSources or simply by the user
oColumn.DataBind.SetBound(True, "OCRD", "CardCode")
Hope it helps
Trinidad.
PS: Please assign points to the answer if it is satisfactory for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you're using SAP 6.5, this will help you with implementing it. I've copied this from a previous post.
I've done this many times with Business One 6.5. It is not officially supported by the SDK, but it can certainly be done with some creativity.
The trick is to catch the et_MATRIX_LINK_PRESSED event that is raised when the link button is clicked, and manually handle the displaying of the target data.
Here's some code that will get you well on your way to implementing the link buttons.
This block adds a column for each field on a UDT. One of the fields is added as a link button.
Set UDT = GetUserDefinedTable(SITE_TABLE_NAME, Company)
If Not UDT Is Nothing Then
If UDT.UserFields.Fields.Count > 0 Then
For Index = 0 To UDT.UserFields.Fields.Count - 1
'Debug.Print UDT.UserFields.Fields.Item(Index).Name
If UDT.UserFields.Fields.Item(Index).Name = "U_SiteNum" Then
Set Column = Columns.Add(UDT.UserFields.Fields.Item(Index).Name, it_LINKED_BUTTON)
Else
Set Column = Columns.Add(UDT.UserFields.Fields.Item(Index).Name, it_EDIT)
End If
With Column
.TitleObject.Caption = UDT.UserFields.Fields.Item(Index).Description
.Width = 100
.Editable = False
' Field is invisible if it is in the excludes list
.Visible = Not FieldsToExclude.Exists(Trim(UCase(UDT.UserFields.Fields.Item(Index).Name)))
Call .DataBind.SetBound(True, "@" & SITE_TABLE_NAME, UDT.UserFields.Fields.Item(Index).Name)
End With
Next Index
End If
Else
Call Application.MessageBox("Unable to get handle to " & SITE_TABLE_NAME)
End If
This code here is what happens when the link button event is caught.
Case et_MATRIX_LINK_PRESSED
If pVal.Before_Action = False Then
If pVal.ItemUID = SITE_MATRIX_UID Then
Call GotoLinkClickedInMatrix(FormUID, SITE_MATRIX_UID, "U_SiteNum", pVal.Row, SITE_FORM_NUMBER + SAP_CUSTOM_FORM_ADD_FACTOR, SITE_MENU_UID, "U_SiteNum", "1", Application, "U_BPCode")
End If
End If
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just want to specify that this feature is only available since SBO 2004 (6.7)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.