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:



    I tried using this tip:
    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:

    ' 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
    "===> Cancel" )
    "Load Default")
                lvMouseMenu.SetSize( lvMouseMenu.Width, lvMouseMenu.Items.Size * 
    30dip )
                lvMouseMenu.Top = y + 
                lvMouseMenu.Left = x
                lvMouseMenu.Visible = 
                BringToFront( pnMenuSettings ) 
    ' the Pane
                BringToFront( tvMenuSettings ) ' the TableView
                BringToFront( lvMouseMenu ) ' the ListView
                DisplayTimer.Enabled = True
    End If
    End If
    End Sub ' tvMenuSettings_MouseClicked()
  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:
    lvMouseMenu.Top = y + 50dip
    If lvMouseMenu.Top + lvMouseMenu.Items.Size * 30dip >= pnMenuSettings.Height Then
           lvMouseMenu.Top = pnMenuSettings.Height - lvMouseMenu.Items.Size * 
    End If
  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