When doing this, it works fine (on the item master form). The udfs that I don't want to be editable are disabled (grayed out). But as soon as anything is typed into ANY field on any pane in the main form or into any of my editable UDFs, the disabled fields immediately become enabled again! (If I listen for key-down on a field & redisable my UDFS it works, and further entry into any field does not affect the enabled status! This is obviously no solution, though. There might be over a hundred fields on this form and it's impratical to listen for key down on all of them!)
I'm doing this as a proof of concept, and if we get it right, we're likely to sell this customer SAP B1, so I'd really like to get this right! 😊
So, searching the forum, I see something about SetAutoManagedAttribute & I try setting the editable attribute to false for these fields. That line of code crashes:
item2.SetAutoManagedAttribute(BoAutoManagedAttr.ama_Editable, SAPbouiCOM.BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_False)
with a message: "Exception from HRESULT: 0xFFFFE4A2."
(NO text with ANY of these HRESULT messages - where can i find info on them?)
I thought maybe the problem was that I can't use the SET feature for UDFS so I've tried it on the itemcode field itself and this bombs out too!
<B1Listener(BoEventTypes.et_MENU_CLICK, False)> _
Public Overridable Sub OnAfterMenuClick(ByVal pVal As MenuEvent)
Dim form As Form
form = B1Connections.theAppl.Forms.ActiveForm
Dim it As Item = form.Items.Item("5")
Dim pl As Integer = form.PaneLevel
If pl <> 1 Then
form.Freeze(True)
form.PaneLevel = 1
form.Freeze(False)
Try
it.SetAutoManagedAttribute(BoAutoManagedAttr.ama_Editable, SAPbouiCOM.BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_True)
Catch ex As Exception
End Try
End If
If form.PaneLevel <> pl Then
form.Freeze(True)
form.PaneLevel = pl
form.Freeze(False)
End If
(I saw another post on the forum about not being able to change the visible attribute unless the current pane contained the field being changed, so that's why I'm trying to switch it & switch it back and I've tried the SET command without the panelevel switch and I always get the same error)
PS I'm at p16 - THANK YOU!