vfafou Well-Known Member Licensed User Longtime User Sep 3, 2020 #1 Hello! I need to use a transparent panel and pass the touch event under this panel. For this reason I use reflector with: B4X: Private r As Reflector r.Target = pnlTouch r.SetOnTouchListener("pnlTouch_MyTouch") Logging the Action parameter, I see only 0 = ACTION_DOWN. I additionally need to use the other 2 actions of the built-in touch event, ACTION_MOVE and ACTION_UP but they don't fire with reflector. GestureDetector has exactly the same behaviour. Is there any other approach to have a similar functionality? Thank you in advance!
Hello! I need to use a transparent panel and pass the touch event under this panel. For this reason I use reflector with: B4X: Private r As Reflector r.Target = pnlTouch r.SetOnTouchListener("pnlTouch_MyTouch") Logging the Action parameter, I see only 0 = ACTION_DOWN. I additionally need to use the other 2 actions of the built-in touch event, ACTION_MOVE and ACTION_UP but they don't fire with reflector. GestureDetector has exactly the same behaviour. Is there any other approach to have a similar functionality? Thank you in advance!
drgottjr Expert Licensed User Longtime User Sep 4, 2020 #2 Is there any other approach to have a similar functionality? Click to expand... do you mean is there some other approach that doesn't work like they don't work? or do you mean you wanted something that fires on action_down, action_more, etc? because if that's what you want, just use the touch events generated by the panel. i use them; they all fire no problem: up, down, move, not move. what's with reflection? the panel's touch event is already, as you say, built in. what is it that you're doing that doesn't make it work? Upvote 0
Is there any other approach to have a similar functionality? Click to expand... do you mean is there some other approach that doesn't work like they don't work? or do you mean you wanted something that fires on action_down, action_more, etc? because if that's what you want, just use the touch events generated by the panel. i use them; they all fire no problem: up, down, move, not move. what's with reflection? the panel's touch event is already, as you say, built in. what is it that you're doing that doesn't make it work?
agraham Expert Licensed User Longtime User Sep 4, 2020 #3 vfafou said: Logging the Action parameter, I see only 0 = ACTION_DOWN Click to expand... Are you sure? I am presently developing an app adding the event using identical code, but with a label, and there is no problem identifying the different actions. drgottjr said: what's with reflection? the panel's touch event is already, as you say, built in Click to expand... Adding the event by reflection ensures that the event is called immediately. The built in touch events go via the message loop which delays them so if you are using the move actions to drag something around adding the event by reflection gives a smoother feel. Upvote 0
vfafou said: Logging the Action parameter, I see only 0 = ACTION_DOWN Click to expand... Are you sure? I am presently developing an app adding the event using identical code, but with a label, and there is no problem identifying the different actions. drgottjr said: what's with reflection? the panel's touch event is already, as you say, built in Click to expand... Adding the event by reflection ensures that the event is called immediately. The built in touch events go via the message loop which delays them so if you are using the move actions to drag something around adding the event by reflection gives a smoother feel.
vfafou Well-Known Member Licensed User Longtime User Sep 4, 2020 #4 Hello @drgottjr! Thank you for your response! or do you mean you wanted something that fires on action_down, action_more, etc? Click to expand... Yes, I need something that fires all actions available but via reflection, because I need to pass the event to the underlying view after executing some code before the Return False. For that reason it isn't usable the built-in event of the panel. Upvote 0
Hello @drgottjr! Thank you for your response! or do you mean you wanted something that fires on action_down, action_more, etc? Click to expand... Yes, I need something that fires all actions available but via reflection, because I need to pass the event to the underlying view after executing some code before the Return False. For that reason it isn't usable the built-in event of the panel.
vfafou Well-Known Member Licensed User Longtime User Sep 4, 2020 #5 agraham said: Are you sure? I am presently developing an app adding the event using identical code, but with a label, and there is no problem identifying the different actions. Click to expand... Hello @agraham! Thank you for your response! Do you mean that instead of a panel you put a label and fire all actions? If yes, then I will try it! Upvote 0
agraham said: Are you sure? I am presently developing an app adding the event using identical code, but with a label, and there is no problem identifying the different actions. Click to expand... Hello @agraham! Thank you for your response! Do you mean that instead of a panel you put a label and fire all actions? If yes, then I will try it!
agraham Expert Licensed User Longtime User Sep 4, 2020 #6 Yes, I am using it to drag drag labels around an Activity by touch to rearrange the layout. I don't see why it wouldn't work with any other view. Post a small project that illustrates the problem. Upvote 0
Yes, I am using it to drag drag labels around an Activity by touch to rearrange the layout. I don't see why it wouldn't work with any other view. Post a small project that illustrates the problem.
vfafou Well-Known Member Licensed User Longtime User Sep 4, 2020 #7 agraham said: Yes, I am using it to drag drag labels around an Activity by touch to rearrange the layout. I don't see why it wouldn't work with any other view. Post a small project that illustrates the problem. Click to expand... I have attached a fresh B4APages project with the same problem! I think that I do something wrong... Attachments B4APagesP1.zip B4APagesP1.zip 10 KB · Views: 715 Upvote 0
agraham said: Yes, I am using it to drag drag labels around an Activity by touch to rearrange the layout. I don't see why it wouldn't work with any other view. Post a small project that illustrates the problem. Click to expand... I have attached a fresh B4APages project with the same problem! I think that I do something wrong...
agraham Expert Licensed User Longtime User Sep 4, 2020 #8 Return True, not False in the Panel2_MyTouch event. Upvote 0
vfafou Well-Known Member Licensed User Longtime User Sep 4, 2020 #9 agraham said: Return True, not False in the Panel2_MyTouch event. Click to expand... OK, by returning False I can’t move the underlying object, but I need the actions to control the visibility of an imageview on top of the layout! If you want, I can send you screenshots to see what exactly I mean! Upvote 0
agraham said: Return True, not False in the Panel2_MyTouch event. Click to expand... OK, by returning False I can’t move the underlying object, but I need the actions to control the visibility of an imageview on top of the layout! If you want, I can send you screenshots to see what exactly I mean!
agraham Expert Licensed User Longtime User Sep 4, 2020 #10 vfafou said: f you want, I can send you screenshots to see what exactly I mean! Click to expand... No point, you can either return True or False so if the behaviour of neither does what you want you need rethink your architecture. Upvote 0
vfafou said: f you want, I can send you screenshots to see what exactly I mean! Click to expand... No point, you can either return True or False so if the behaviour of neither does what you want you need rethink your architecture.
vfafou Well-Known Member Licensed User Longtime User Sep 4, 2020 #11 OK @agraham, may I need to redesign this functionality from scratch! Thank you very much for your time! Upvote 0
OK @agraham, may I need to redesign this functionality from scratch! Thank you very much for your time!