Android Question How To Disable ListView When Panel Is On Front?

ronovar

Active Member
Licensed User
Longtime User
I need to disable ListView selection when i get Panel in Front of ListView so that i can using keys up or down on remote control do thinks in panel.

I try using:

Dim lv1 As ListView
Dim pnl1 As Panel

lv1.Enabled = False
lv1.BringToFront
pnl1.RequestFocus

But when i press up and down buttons on my remote control panel items is moving like it should but listview lv1 items are moving also up and down and they should not be moving...so how to fix this?
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
If you want the panel to be receiving input instead of the listview why are you not using "pnl1.BringToFront"? Then if you touch your 'phone screen the panel touch handler, rather than the listview, would receive the touch information first.

But I do not understand what you mean by the "remote control" that you are using. This might make my reply nonsense.
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
I try to put BrintToFront on pnl1 but it is not working...pnl1 is receiving information first but listview lv1 is receiving information too and it going up or down, depending what user press on remote control.

Remote control is android box with remote control...like this on picture:

00.jpg
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I see. So I guess that the device that is running the Android App is a TV. I am afraid that is not something that I have worked on.

I have just tested out what you are trying to do on my 'phone. I created a listview and a panel, added a hundred lines of text to the listview, and then brought the panel to the front.

When I touch the screen the panel touch event fires, and the list view cannot be scrolled, which is what you want and what I expected. So the device that you are using is working in a non-standard way, and it appears that this technique will not work. You will have to think up something else.
 
Upvote 0

ronovar

Active Member
Licensed User
Longtime User
Ok thanks...if you could poste B4A project that you have try and works for you so that i can test it on box and my phone to see where is the catch..maybe i am missing something?
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Here it is ...

B4X:
Sub Process_Globals

End Sub

Sub Globals
    Dim lstTest As ListView
    Dim pnlTop As Panel
End Sub

Sub Activity_Create(FirstTime As Boolean)
     addViews
     pnlTop.BringToFront
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub addViews
    lstTest.Initialize("")
    Activity.AddView(lstTest, 0dip, 0dip, Activity.Width, Activity.Height)
    pnlTop.Initialize("panel")
    Activity.AddView(pnlTop, 0dip, 0dip, Activity.Width, Activity.Height)
    For i = 1 To 100
        lstTest.AddSingleLine("Test Data line " & i)
    Next
End Sub

Sub panel_Touch (Action As Int, X As Float, Y As Float) As Boolean
    ToastMessageShow("Touched", False)
    Return True                              ' Signal that the event is "consumed"
End Sub
    
End Sub

I hope that this helps. Good luck.
 
Upvote 0
Top