cancel
Showing results for 
Search instead for 
Did you mean: 

UIAPI indicate selected row in Matrix

Former Member
0 Kudos

Hi all,

here is another question with no answer to it yet.

We are still working with version 6.2.

As far as I know there are (at least) two known problems with the matrix object

a) there is no "selected row" property returning a row object - this can be dealt with by using the pval.row property and adressing the different row columns directly

b) in 6.2 the selection of a row can not indicated by a change of color

Regarding the color change:

If a user clicks on a row in 6.2, is there any way to mark the row as selected? Not necessarily a colorchange, any workaround will do.

I have tested the following:

-add another column of type checkbox

-on Click event uncheck the checkbox in previous row and check the one in the current row

This looks promising, but still does not work 100%.

Any other propositions for a workaround?

TIA Lutz Morrien

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Just to let people know:

I did manage to use checkboxes in a matrix in order to indicate a selected row in a version 6.20 matrix. It is kind of clumsy as a workaround and does not look too SAP, but it does work. If anyone needs this workaround, I can post some code.

Lutz Morrien

Former Member
0 Kudos

Please post the code.

Thanks!

Former Member
0 Kudos

Hi xml for form definition follows. It should result in a new form with a Matrix containing one column with checkboxes (used to mark selected row):

<?xml version="1.0" encoding="iso-8859-1"?>

<Application>

<forms>

<action type="add">

<form type="0" uid="" title="XXXTest" visible="1" default_button="1" color="0" top="100" height="420" width="670" appformnumber="9000">

<datasources>

<dbdatasources>

</dbdatasources>

<userdatasources>

<action type="add">

<datasource uid="US_CHK" type="8" size="1"/> </action>

</userdatasources>

</datasources>

<items>

<action type="add">

<Item type="4" left="6" width="65" top= "340" height="21" visible="1" enabled="1" form_pane="0" to_pane="0" disp_desc="1" right_just="0" description="OK" uid="1">

<Specific caption="OK" />

</Item>

<Item type="4" left="75" width="65" top="340" height="21" visible="1" enabled="1" form_pane="0" to_pane="0" disp_desc="0" right_just="0" description="Cancel" uid="2">

<Item type="127" left="5" width="640" top="30" height="300" visible="1" enabled="1" form_pane="0"

to_pane="0" disp_desc="0" right_just="0" description="" uid="XXXMatrix">

<Specific>

<columns>

<action type="add">

<column title="" description="" visible="1" uid="XXXCHK" type="121" width="20" disp_desc="0" editable="1"> <databind databound="1" alias="US_CHK" table="" />

</column>

</action>

</columns>

</Specific>

</Item>

</action>

</items>

</form>

</action>

</forms>

</Application>

Former Member
0 Kudos

And here is the event handling code in VB .Net:

It is not pretty, but it works.

HTH Lutz Morrien

Private Sub MarkCurrentRow(ByRef pVal As SAPbouiCOM.ItemEvent)

Try

'if an actual row was selected and it has not been selected before

If intCurrentRow > 0 And intCurrentRow <= MyMatrix.RowCount _

And intCurrentRow <> intPreviousRow Then

If intPreviousRow > 0 And intPreviousRow <= MyMatrix.RowCount Then

'uncheck previous row

Me.Parent.Parent.BlockEvents = True

edtCheck = ColCheck.Cells.Item(intPreviousRow).Specific

edtCheck.Checked = False

Me.Parent.Parent.BlockEvents = False

End If

'if user has not clicked on checkbox itself then...

If pVal.ColUID <> "XXXCHK" Then

'Check checkbox in current row

Me.Parent.Parent.BlockEvents = True

edtCheck = ColCheck.Cells.Item(intCurrentRow).Specific

edtCheck.Checked = True

Me.Parent.Parent.BlockEvents = False

End If

End If

Catch excE As Exception

SBO_Application.MessageBox(excE.ToString)

Finally

'listen again

Me.Parent.Parent.BlockEvents = False

End Try

End Sub

Public Overrides Sub HANDLE_FORM_EVENTS(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean)

If pVal.Before_Action = True Then

Select Case pVal.EventType

Case SAPbouiCOM.BoEventTypes.et_CLICK

Select Case pVal.ItemUID

Case "XXXMatrtix"

If pVal.Row > 0 Then

intPreviousRow = intCurrentRow

intCurrentRow = pVal.Row

MarkCurrentRow(pVal)

End If

End Select

Case SAPbouiCOM.BoEventTypes.et_DOUBLE_CLICK

Select Case pVal.ItemUID

'Matrix has been doubleclicked :do something

End Select

End Select

'AFTER ACTION

Else

Select Case pVal.EventType

Case SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED

'check on item and do something

End Select

End If

End Sub

Former Member
0 Kudos

Hi Lutz

I've stopped to waste my time with the poor 6.2. In the 6.5 selection of the row is simple and nice. But one construction in your code is very interesting to me:

Me.Parent.Parent.BlockEvents = True

What's BlockEvents method? I can't find it in any help.

Could you explain?

Best regards,

Mark

Former Member
0 Kudos

Hi,

the BlockEvents method is self made. (I simply forgot to take it out I guess).

It exists in the topmost class which is connected to SAP via UIApi. If I set blockEvents to true, this class blocks off all events the class gets from SAP until I finish an action. It just does not hand them down to other classes.

If I perform an action, I get a number of events until the action is complete. If I know that my application does not need to handle these events, I block all events at top level until the action has been completed.

It is not a SAP built function.

I know about the flaws in 6.2 and I really do not get along too well with it. However, our customers are not upgrading yet and therefore I am stuck with 6.2 ;(

The fact that one cannot run a 6.2 and 6.5 client on the same machine does not help either.

Lutz Morrien