B4J Question [AsViewPager] block or consume event

micro

Well-Known Member
Licensed User
Longtime User
Hi to all
I am using AsViewerPage component (Alexander stolte library) in a b4J project
This run on a Touch PanelPC.
The passage from one page to another must take place only from code, but if I drag the page with my finger, they scroll and this must not happen.
How i can consume or block event in TouchBegin?
Thanks

P.S.
just to clarify
the IgnorePageChangedEvent property, does not resolve the problem.
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
The passage from one page to another must take place only from code, but if I drag the page with my finger, they scroll and this must not happen.
How i can consume or block event in TouchBegin?
The scrolling is not done by the library, but by the xCustomListView (on B4J based on ScrollPane) in the background.
but how to stop the touch there, I do not know.
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
The scrolling is not done by the library, but by the xCustomListView (on B4J based on ScrollPane) in the background.
but how to stop the touch there, I do not know.
?
the problem is that it is a project that took me a long time and I developed it on this library (AsViewPager), if I knew this problem I would have looked for another solution.

Thanks and Best regards
 
Last edited:
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
the problem is that it is a project that took me a long time and I developed it on this library (AsViewPager), if I knew this problem I would have looked for another solution.
maybe someone else has a solution, you can make a new thread, how to disable the touch on scrollpane on touch devices.
I have unfortunately no way to test this, because I do not have a touch device with windows.
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
I found this thread. Maybe this helps
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
I have tried with this
B4X:
Private ps as Scroolpane
......
ps = AsViewPager1.CustomListView.sv
ps.Pannable = false
but not work
Each page I load inside ASViewPager has a main Pane but the only event I can use for these Pane is the Touch but not the Mousexxxxx.
But the Touch event does not have the EventData parameter to be able to consume the event.
Other solutions?
Thanks
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
a solution can be this:
B4X:
Dim jo As JavaObject = AsViewPager1.CustomListView.sv
jo.RunMethod("setMouseTransparent", Array(True))
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
maybe this can be interesting too
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Dim jo As JavaObject = AsViewPager1.CustomListView.sv jo.RunMethod("setMouseTransparent", Array(True))
Hi Alexander
As you well know this also disables the Click event on other views and playing with the MousEneterd and MouseExit events to enable or disable the mouse sometimes causes unwanted sistuations, then this method is not optimal.
Let's see what else to do .....
Thanks
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
To better search for solutions, I have activated the touch with the mouse, did not know that such a thing goes:
B4X:
Dim ps As ScrollPane = ASViewPager1.CustomListView.sv
ps.Pannable = True

i have come up with the following solution:
  1. Add a panel with full height and width
  2. B4X:
    Private Sub tmp_xpnl_MouseDragged (EventData As MouseEvent)
        EventData.Consume
    End Sub
  3. done, no more scrolling with touch/mouse
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…