backKey with DataGrid

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

backKey with DataGrid

Paul Dupuis via use-livecode
Here's a weird one...   I have a card with a number of objects on it.  There is a button named "Back" which takes you back to card X.  There is also a dataGrid.  In the mainStack script, I have a this backKey command:

on backKey
  //this is sent only on Android when the user presses the hardware "back" key
  if there is a btn "Back" of this card then
    send "mouseUp" to btn "Back" of this card in 1 tick
  end if
 
  exit to top
end backKey

When the card opens, and you tap the backKey (on an android device of course), it works great!   Now, if I scroll the dataGrid, the backKey message fails.  If I then tap any other control on the screen (not the dataGrid), then the backKey message works again.  This is true even if the dataGrid has no data (ie.:  set the dgData of grp "myDataGrid" to "").

I have verified that there is only 1 button named "Back" on the entire card (including the template for the dataGrid).

When I say the "backKey" message fails, what really happens is the statement  "if there is a btn "Back" of this card" does result as true, but the sending of the "mouseUp" message isn't sent (or perhaps it's not received).  Also, if I just tap the "Back" button it does go back.

Any ideas?

-Dan

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: backKey with DataGrid

Paul Dupuis via use-livecode
This is a shot in the dark but this may have to do with the fact that once the dataGrid is in focus the template stack for the dataGrid becomes the recipient of your backKey message. Have you tried to add a backKey message to the template stack, and tweaking it to reference the button of the card in the original stack?

Best regards
Tore Nilsen


> 7. okt. 2020 kl. 00:19 skrev Dan Friedman via use-livecode <[hidden email]>:
>
> Here's a weird one...   I have a card with a number of objects on it.  There is a button named "Back" which takes you back to card X.  There is also a dataGrid.  In the mainStack script, I have a this backKey command:
>
> on backKey
>  //this is sent only on Android when the user presses the hardware "back" key
>  if there is a btn "Back" of this card then
>    send "mouseUp" to btn "Back" of this card in 1 tick
>  end if
>
>  exit to top
> end backKey
>
> When the card opens, and you tap the backKey (on an android device of course), it works great!   Now, if I scroll the dataGrid, the backKey message fails.  If I then tap any other control on the screen (not the dataGrid), then the backKey message works again.  This is true even if the dataGrid has no data (ie.:  set the dgData of grp "myDataGrid" to "").
>
> I have verified that there is only 1 button named "Back" on the entire card (including the template for the dataGrid).
>
> When I say the "backKey" message fails, what really happens is the statement  "if there is a btn "Back" of this card" does result as true, but the sending of the "mouseUp" message isn't sent (or perhaps it's not received).  Also, if I just tap the "Back" button it does go back.
>
> Any ideas?
>
> -Dan
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode