bug?: panel and label

Cor

Active Member
Licensed User
Longtime User
I have labels on my main activity

then i show a panel

the labels from the main activity are also shown

labels have activity as parent

attached demo to show the problem

grCor
 

Attachments

  • panelAndLabel.zip
    5.7 KB · Views: 309

klaus

Expert
Licensed User
Longtime User
It's not a bug, you must set the panel on top with BringToFront in the designer in the Tools menu.
The last generated Views are on top of the display hierarchy.
You probably set the Panel first and the other views afterwards.
In your example you'll need something to set the panel invisible.

It would be intersting to have a method to set 'BringToFront' by code.

Best regards.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It would be intersting to have a method to set 'BringToFront' by code.
I agree.

Till this is added you can use this Sub instead:
B4X:
Sub Globals
    
    Dim Button1 As Button
    Dim Button2 As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
    BringToFront(Button1)
End Sub

Sub BringToFront (v As View)
    For i = 0 To Activity.NumberOfViews - 1
        If activity.GetView(i) = v Then
            activity.RemoveViewAt(i)
            activity.AddView(v, v.Left, v.Top, v.Width, v.Height)
            Exit
        End If
    Next
End Sub
 
Top