Scrollview how to

madru

Active Member
Licensed User
Longtime User
Good day,

so, my 2nd post and my 2nd problem

I try to port a 'TV system' and I need to put hundreds of TV-Channel Icon on the page. Please see the attached Image for the current App. running on a non Android device. (the green marked area, the orange area will hold info about EPG etc.) On every Page you have 40 Icon which are selectable via remote cross navigation.

The question now is how to do it on Android using B4A, my idea was to use a scrollview and put all 250 icons in there - but I failed - really no idea how to get them in and selectable

any help is appreciated

THX

Madru

oops missed that on, there is NO touch screen!!!! only Up, Down, Left, Right and Enter for navigation
 

Attachments

  • screen.jpg
    37.1 KB · Views: 317

madru

Active Member
Licensed User
Longtime User
THX Erel

that helped a lot.....

I tried to get a click event attached to you code, tried with ImageView and Panel:

B4X:
   For x = 0 To 7
      For y = 0 To 14
      bmp = LoadBitmap(File.DirAssets, Rnd(0,20)&".jpg") ' dummy icons
         Dim iv As ImageView
         Dim p As Panel
         iv.Initialize("ImageViewEvent")
         iv.SetBackgroundImage(bmp)
         iv.Gravity = Gravity.FILL
         p.Initialize("PanelEvent")

         sv.Panel.AddView(p, x * size, y * size, size, size)
         p.Color = Colors.RGB(248,246,241)
         p.AddView(iv, 5dip, 5dip, size - 10dip, size -10dip)
         panels(x, y) = p
      Next
   Next
   ' DVB_OK = DVB_Reader(1,604, 256,1,0 ) 'Start DVB Reader, Freq, QAM, Inversion, use NIT 
   ChangeSelection(0, 0)
End Sub

Sub ImageViewEvent_Click
   Dim I As ImageView
       I = Sender
End Sub
Sub PanelEvent_Click
   Dim p As Panel
      p = Sender
End Sub

but with no luck....

what I'm doing wrong now ?

THX
 
Upvote 0

madru

Active Member
Licensed User
Longtime User
Erel,

stripped down Version attached, shows the same behavior....

THX for your support
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I just tested your program and it works as expected.
Clicking on an image enters the ImageViewEvent_Click routine.
Clicking between two images enters the PanelEvent_Click routine.
You can check it easily by activating the debugger and setting a breakpoint in each routine.
I don't know what you expected in the routines.

Why are you using ImageViews plus Panels. ImageViews would be enough.
You must set the Tag property for the ImageViews to a combination of x and y to know what view raised the event.

Attached a modified version.

Best regards.
 
Last edited:
Upvote 0

madru

Active Member
Licensed User
Longtime User
THX Klaus, getting closer now…..

…..the cause of the problem is the not existing touch screen and the touch screen emulation

I was able to verify your result with an AirMouse but not with the official remote control. Looks like the remote need to have the focus set on the selected item or something …… ……doesn't work either

any ideas ?
 
Last edited:
Upvote 0

madru

Active Member
Licensed User
Longtime User
DONE

I replaced the Imageview with a button and voila it does work. Is it possible that an Imageview does not deal with focus at all or correctly ?

THX

:sign0100:
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…