Android Question [SOLVED] mSideLeft Jumps Up Top Only When First Thing - New I Think

mmieher

Active Member
Licensed User
Longtime User
It just has to be me. As you can see, I have struggled with this before. The "GET THIS OUTTA HERE" line was the solution. Darn-close exact same thing works in many other projects. I checked one. Started this project today (7/6/22) as everybody already knows. Most of this log stuff is usually commented out. What is going on?

B4X:
'     In B4A it is called when the user clicks on the back key or on the up indicator.
'     In B4J it is called when the user clicks on the close button. 
Private Sub B4XPage_CloseRequest As ResumableSub
    LogSub("B4XPage_CloseRequest")
    
    If Main.ActionBarHomeClicked Then
        Log("Main.ActionBarHomeClicked")
        Drawer.LeftOpen = Not(Drawer.LeftOpen)
        
        If Drawer.LeftOpen Then
            Log("B4XMain drawer open")
            ActionButtonIcon(BackArrowIcon)
            
            ''Drawer.LeftPanel.BringToFront    '    does not work, try it anyway
            WhatIsThis.RemoveView    '    GET THIS OUTTA HERE
            
            '    not crazy about this.  should put tags in page so i know which view to remove
            '    should i remove all views wxcept view(0)?
            '    why am i doing this?  something to do with modules in this page?
            ''            Dim nViews As Int = Root.NumberOfViews
            ''            If nViews > 1 Then
            ''                Dim p As B4XView = Root.GetView(Root.NumberOfViews-1)
            ''                p.RemoveViewFromParent
            ''            End If
            
        Else
            Log("B4xMain drawer NOT open")
            ActionButtonIcon(HamburgerIcon)
            
        End If
        
        Return False

    ... more stuff
 
Solution
As near as I can tell, the B4X menu stuff only works for me when the CenterPanel is the center of attention. Admitting that solved everything. Plus, I really did not want the menu to be active when the CP is not the focus anyway.

mmieher

Active Member
Licensed User
Longtime User
DEBUG just does not work for me in this sub and a few other. Too much going on I guess.
 
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
Sorry.
B4X:
            WhatIsThis.RemoveView    '    GET THIS OUTTA HERE
ultimately makes things worse. I just caught a good clue. I think I will find this soon. Wrong page when waiting for Back Arrow click. It just always has something to do with that Root.LoadLayout guy. I only do that once per creation.

[more] OMG. The Hamburger icon is still there.
[even more] Gotta be! I usually do not have this "extra" page thing in a project. Geez. This project is still small if anybody wants the upload. The code reads sorta like my posts.
 
Last edited:
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
If somebody else understands the answer "370 days" and gets stuck in the same wrong place, something like this might work for you.
B4X:
Private Sub bChoice_Click
    LogSub("bChoice_Click")
 
    WhatIsThis.Initialize("")
    WhatIsThis.SetLayoutAnimated(0, 0, 0, 100%x, 100%y)
    WhatIsThis.LoadLayout("WhatIsThis")
    Root.AddView(WhatIsThis,0,0,100%x,100%y)
 
    ActionButtonIcon(BackArrowIcon)    '    try this
 
End Sub

Please mark as "the Solution".
 
Last edited:
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
I can name most of the people I beat to this ... barely:

B4X:
Private Sub bChoice_Click
    LogSub("bChoice_Click")
  
'    WhatIsThis.Initialize("")
'    WhatIsThis.SetLayoutAnimated(0, 0, 0, 100%x, 100%y)
'    WhatIsThis.LoadLayout("WhatIsThis")
'    Root.AddView(WhatIsThis,0,0,100%x,100%y)
'  
'    ActionButtonIcon(BackArrowIcon)    '    try this

    Root.RemoveAllViews                '    thought this was really bad
    Root.LoadLayout("WhatIsThis")
  
End Sub

[still not newest best way - contact me if you care]
[wtf?]
 
Last edited:
Upvote 0

mmieher

Active Member
Licensed User
Longtime User
As near as I can tell, the B4X menu stuff only works for me when the CenterPanel is the center of attention. Admitting that solved everything. Plus, I really did not want the menu to be active when the CP is not the focus anyway.
 
Upvote 0
Solution
Top