[Solved] <touch> control in a layout with tabs - bug?
Hi - I'm trying to figure out how to get a touch control to work in a tabbed layout. I'm new to this, but I think I may have found a bug in the Android app.
If I put a touch control on a layout without tabs, it works as expected. But when I put a touch control on a tabbed layout, dragging horizontally on the touch control doesn't register as a touch. Instead, it switches between the tabs. If I move vertically on the touch control before moving horizontally, it works.
Sliders work fine in tabbed layouts.
Am I doing something wrong, or is this a bug?
I'm using the following layout:
<?xml version="1.0" encoding="utf-8"?> <layout> <tabs> <tab text="Brush"> <row> <touch id="thetouch" text="- Brush Size +" ontouchabs="moved" /> </row> <row> <button id="thebutton" text="Hi there" ontap="tapped" /> </row> </tab> <tab text="Page 2"> <row> <button text="button" /> </row> </tab> </tabs> </layout>
Definitely a bug. The tab control would have to stop listening for touch events if it detects a touch control. That is something we'll have to fix in the app. In the meantime, here is a potential workaround. Create a layout with your buttons and touch areas.
<?xml version="1.0" encoding="utf-8"?> <layout> <row weight="wrap"> <button text="Page 1" ontap="page1" /> <button text="Page 2" ontap="page2" /> </row> <row> <touch id="touch1" text="Touch 1" /> <touch id="touch2" text="Touch 2" visibility="gone" /> </row> </layout>
Toggle the visibility of the touch areas when you press the buttons.
actions.page1 = function () layout.touch2.visibility = "gone"; layout.touch1.visibility = "visible"; end actions.page2 = function () layout.touch1.visibility = "gone"; layout.touch2.visibility = "visible"; end
This will be fixed in the next release!