B4J Question BringToFront redux [solved]

Discussion in 'B4J Questions' started by Didier9, Jul 26, 2019.

  1. Didier9

    Didier9 Active Member Licensed User

    I have a Pane containing a TableView and a ListView that pops up when I right click the mouse on the TableView.
    Below that Pane, I have a TextArea.

    When I right click on the last line of the TableView, the popup mouse ListView is hidden behind the TextArea:

    Here is what it looks like when I click on the last 3 lines:
    1.png

    2.png

    3.png

    I tried using this tip:
    https://www.b4x.com/android/forum/threads/pane-bringtofront.70149/
    for the Pane, the TableView and the mouse ListView but nothing works. The project is quite big so I can't really attach it but if this is not enough information, I will try to create a small one to show the problem.

    This is the pop-up menu code:

    Code:
    ' SecondaryButtonPressed is the right mouse button
    Sub tvMenuSettings_MouseClicked( EventData As MouseEvent )
        
    Dim x, y As Int
     
        
    ' this event is called *after* SelectedRowChanged()
        If CurrentNVP.Length > 2 And EventData.SecondaryButtonPressed = True Then
            
    If GetMenuCellValue( CurrentNVP( 0 ), 3 ).Length > 0 Then
                
    'Log( "SecondaryButtonPressed" )
                x = EventData.X
                y = EventData.y
                lvMouseMenu.Items.Clear
                lvMouseMenu.Items.Add( 
    "===> Cancel" )
                lvMouseMenu.Items.Add( 
    "Load Default")
                lvMouseMenu.SetSize( lvMouseMenu.Width, lvMouseMenu.Items.Size * 
    30dip )
                lvMouseMenu.Top = y + 
    50dip
                lvMouseMenu.Left = x
                lvMouseMenu.Visible = 
    True
                BringToFront( pnMenuSettings ) 
    ' the Pane
                BringToFront( tvMenuSettings ) ' the TableView
                BringToFront( lvMouseMenu ) ' the ListView
                DisplayTimer.Enabled = True
                EventData.Consume
            
    End If
        
    End If
    End Sub ' tvMenuSettings_MouseClicked()
    TIA
     
  2. Didier9

    Didier9 Active Member Licensed User

    Now that I think of it, it looks like I need to relocate the popup higher so that it is entirely contained in the pane.
     
    emexes likes this.
  3. Didier9

    Didier9 Active Member Licensed User

    I fixed it like this:
    Code:
    lvMouseMenu.Top = y + 50dip
    If lvMouseMenu.Top + lvMouseMenu.Items.Size * 30dip >= pnMenuSettings.Height Then
           lvMouseMenu.Top = pnMenuSettings.Height - lvMouseMenu.Items.Size * 
    30dip
    End If
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice