B4J Question Button.Visible makes wrong action

Andromeda

Member
Licensed User
Longtime User
Hello,

i have a button on a B4XPage and its defined as

Private btnEdit As B4XView

in B4XPage_Created i set it as
btnEdit.Visible = false

The effect is: not editable but its visible

I cant hide it.
 

Andromeda

Member
Licensed User
Longtime User
Here is the project.
To get to the button:

open drawer, goto "Tasks" -> Look at the "Edit" Button. Its disabled, but not hiding.
But i use:
B4X:
Private Sub B4XPage_Appear
    ShowTableTask
    btnEdit.Visible = False
End Sub
 

Attachments

  • VisibleTest.zip
    17.6 KB · Views: 93
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
The problem is that you are loading the layout twice.

B4X:
    Root = Root1
    'load the layout to Root
    Root.LoadLayout("Task")  ' <- Remove this.
    ToastMessage.Initialize(Root)

    #Region Drawer
    Drawer.Initialize(Me, "Drawer", Root, 200dip)
    Drawer.CenterPanel.LoadLayout("Task")
    Drawer.LeftPanel.LoadLayout("drawer")
    HamburgerIcon = xui.LoadBitmapResize(File.DirAssets, "hamburger.png", 32dip, 32dip, True)

comment out the load layout on line 3 and it all works as expected.
 
Upvote 0

Andrew (Digitwell)

Well-Known Member
Licensed User
Longtime User
I notice that you are also doing this on the main page as well.

B4X:
    Root = Root1
    
    'load the layout to Root
    Root.LoadLayout("Main")  <---- Remove this
    MP = B4XPages.MainPage
    
    'initialize the Pages

    Task.Initialize
    B4XPages.AddPage("Task", Task)
    
    Filter.Initialize
    B4XPages.AddPage("Filter", Filter)

    #Region Drawer
    Drawer.Initialize(Me, "Drawer", Root, 200dip)
    Drawer.CenterPanel.LoadLayout("Main")   '<-- Main is loaded here
    Drawer.LeftPanel.LoadLayout("drawer")
    HamburgerIcon = xui.LoadBitmapResize(File.DirAssets, "hamburger.png", 32dip, 32dip, True)
 
Upvote 0
Top