cancel
Showing results for 
Search instead for 
Did you mean: 

How to hide a control (Visible = False) ?

Former Member
0 Kudos

Well,

I wrote this code to create controls dinamically on the Employee Master form, but the only thing that doesn't work is the Visible property of a couple of textboxes that are supposed to be hidden.

        With oNewTextItem
            .Left = mintLeft
            .Top = mintTop
            .Width = intWidth
            .Height = intHeight
            .TextStyle = intTextStyle
            .FromPane = intFromPane
            .ToPane = intToPane
            .Visible = blnVisible
            If Not blnVisible Then
                .SetAutoManagedAttribute(SAPbouiCOM.BoAutoManagedAttr.ama_Visible, SAPbouiCOM.BoAutoFormMode.afm_All, SAPbouiCOM.BoModeVisualBehavior.mvb_False)
            End If
            If Not oLabelItem Is Nothing Then
                oLabelItem.LinkTo = .UniqueID
            End If
            mobjTextBox = .Specific
        End With
        With mobjTextBox ' data bind
            If Len(Trim(strFieldName)) > 0 Then .DataBind.SetBound(True, strTableName, strFieldName)
        End With

Why it .Visible and/or SetAutoManagedAttribute doen't work ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

To set the visible property of an item to true or false, the current pane must be the pane of the item.

If the form pane is 1, and your item pane is 4, you cannot change it directly.

you can freeze the form, change the form pane to 4, set the item visible property, and change back the pane to 1, and finally unfreeze the form

HTH

Sebastien

Former Member
0 Kudos

Thanks Sébastien

I already figure out that I could hide the control by simply specifying a high number, say 20 to the FromPane and ToPane properties.

Not elegant but it works.

Former Member
0 Kudos

yes, it's a solution.

the only thing is that if you want to set the item back to visible, you'll have to first record its initial Pane somehow.

Former Member
0 Kudos

yes, that's true!

But in this case I don't need to perform that since I want them permanently hidden. It's a good tip though, one that might serve me in the future!

Thanks again!

Answers (1)

Answers (1)

Former Member
0 Kudos

how to hide a control ... the SAP way!