cancel
Showing results for 
Search instead for 
Did you mean: 

UI - LinkedButton - MatrixCell

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Trinidad
Product and Topic Expert
Product and Topic Expert
0 Kudos

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.

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

I just want to specify that this feature is only available since SBO 2004 (6.7)