cancel
Showing results for 
Search instead for 
Did you mean: 

Hide field in the summary tab

former_member193355
Contributor
0 Kudos

Hi All,

using this code belows, I still can't hide the field of summary tab in the production order

Public Sub New()

            MyBase.New()

            FormType = "65211"

        End Sub

        <B1Listener(BoEventTypes.et_FORM_LOAD, False)> _

        Public Overridable Sub OnAfterFormLoad(ByVal pVal As ItemEvent)

            Dim FormUID As String = pVal.FormUID

            HideControl(FormUID, "38")

            HideControl(FormUID, "39")

            HideControl(FormUID, "138")

            HideControl(FormUID, "140")

            HideControl(FormUID, "40")

            HideControl(FormUID, "41")

            HideControl(FormUID, "42")

            HideControl(FormUID, "43")

        End Sub

    End Class

End Namespace

Please help to fix the issue I have. I appreciate your help so much

Steve

Accepted Solutions (1)

Accepted Solutions (1)

pedro_magueija
Active Contributor
0 Kudos

Hi Steve,

What is the code for HideControl?

Usually the two "recommended" ways are to either change the panelevel of the items to a very high value (ex: 99) or to move them away from the screen by making the top = - 1000 and left = -1000.

The reason for the "recommendation" is that B1 will reset the hide status of some controls when clicking find or add menu options.

Good luck.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

former_member193355
Contributor
0 Kudos

Hi Pedro,

Here is the hide control:

Module GlobalFunctions

    Public Sub HideControl(ByVal FormUID As String, ByVal ItemIndex As Object)

        Try

            Dim Form As SAPbouiCOM.Form = theAppl.Forms.Item(FormUID)

            Form.Items.Item(ItemIndex).Visible = False

        Catch ex As Exception

        End Try

    End Sub

  

End Module

What I need is to hide a tab fields. but using hidecontrol, it is not possible.

If the field is in the header, it is working well.

What is the code for the tab ? Thanks for your reply

Steve

former_member193355
Contributor
0 Kudos

I welcome to anyone that can answer my question. Thank you.

pedro_magueija
Active Contributor
0 Kudos

Hi Steve,

The item must be visible in the screen for B1 to apply the Visible property.

    Public Sub HideControl(ByVal FormUID As String, ByVal ItemIndex As Object)

        Try

            Dim Form As SAPbouiCOM.Form = theAppl.Forms.Item(FormUID)

            Dim fPane As Integer = Form.PaneLevel

            Form.PaneLevel = Form.Items.Item(ItemIndex).FromPane

            Form.Items.Item(ItemIndex).Visible = False

            Form.PaneLevel = fPane

        Catch ex As Exception

        End Try

    End Sub

I'd however recommend that you change your function to receive an array of strings containing the id of the items to hide. Then loop through it in the function, this way you can freeze the form before changing the panelevel and you only change the panelevel once (avoiding screen flickering).

Good luck.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

former_member193355
Contributor
0 Kudos

Hi Pedro,

I understood but a little.

Can you please elaborate your answer with an example ?

I create this :

<B1Listener(BoEventTypes.et_FORM_LOAD, False)> _

        Public Overridable Sub OnAfterFormLoad(ByVal pVal As ItemEvent)

            Dim theAppl As Form

            Dim FormUID As String = pVal.FormUID

            Dim Form As SAPbouiCOM.Form

            Dim fPane As Integer = Form.PaneLevel

            Dim ItemIndex As Integer

            Form.PaneLevel = Form.Items.Item(ItemIndex).FromPane

            'Form.Items.Item(36).Visible = True

            If pVal.EventType = BoEventTypes.et_ITEM_PRESSED and pVal.Before_Action = False Then

                If Form.Items.Item(36).Visible = True Then

                    HideControl2(FormUID, "140")

                End If

                End If

            'End If

        End Sub

but failed

Could you help more ? Thanks

Steve

pedro_magueija
Active Contributor
0 Kudos

Hi Steve,

In the case you show the code is running when the FORM_LOAD event is fired so pVal.EventType = BoEventTypes.et_ITEM_PRESSED is never true and the HideControl2 never runs. Probably that is why it fails.

Here is a sample using B1DE so you can have a look at the code I wrote. It is very simple and only gives an idea of what you should do.

Good luck.


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

former_member193355
Contributor
0 Kudos

Thank you for your reply and sample.

Actually, I would like to hide some fields in the summary tab of the production order.

So, it is not all fields that must be hidden.

In your previous reply, if I use hidecontrol2 for item 36, all fields in the tab will be hidden.

Thanks,

Steve

former_member193355
Contributor
0 Kudos

Hi Pedro,

The problem is now solved. I delete these syntax:

Dim theAppl As Form

          

            Dim Form As SAPbouiCOM.Form

            Dim fPane As Integer = Form.PaneLevel

            Dim ItemIndex As Integer

            Form.PaneLevel = Form.Items.Item(ItemIndex).FromPane

            'Form.Items.Item(36).Visible = True

            If pVal.EventType = BoEventTypes.et_ITEM_PRESSED and pVal.Before_Action = False Then

                If Form.Items.Item(36).Visible = True Then

And created new one. But I have to apply your solution too as follows:

Public Sub HideControl(ByVal FormUID As String, ByVal ItemIndex As Object)

        Try

            Dim Form As SAPbouiCOM.Form = theAppl.Forms.Item(FormUID)

            Dim fPane As Integer = Form.PaneLevel

            Form.PaneLevel = Form.Items.Item(ItemIndex).FromPane

            Form.Items.Item(ItemIndex).Visible = False

            Form.PaneLevel = fPane

        Catch ex As Exception

        End Try

    End Sub

so now, my new syntax work well.

Thanks for your help.

Steve

Answers (0)