I have a very strange problem with Delphi Firemonkey TStringGrid on Android. It looks like that events on TStringGrid are triggered differently on windows and android platform.
For example: in windows firemonkey application I have a string grid with a few columns. TStringGrid is set as read only. OnClick event I have the following code:
TStringGrid(Sender).Cells[TStringGrid(Sender).ColumnIndex,TStringGrid(Sender).Selected] := 'result';
Android application has exactley the same code OnClick event
TStringGrid(Sender).Cells[TStringGrid(Sender).ColumnIndex, TStringGrid(Sender).Selected] := 'result';
When I run windows application and click on string grid cell it becomes selected and then ‘result’ is written in the cell.
windows before click
windows after click
When I run android application and do click (tap) what happens is that ‘result’ is written in previously selected cell, and after that cell where I did click becomes selected.
android before click
android after click
I am not sure is this a bug in Firemonkey or expected behavior. Is there a way to overcome this?
TGrid is not a supported control on mobile so you should avoid using it. The best alternative is probably a TListBox with a custom style.
It might a threading issue. But I'm not so sure you are using the best event handler. If you are trying to update the cell that is being selected, then I would advice you handle the TStringGrid.OnSelChanged event. This event is fired after cell selection has been changed.
Beware though... it is not strictly fired by mouse clicks (or finger taps). If you have some sort of keyboard attached to the Android device, or on a desktop platform, it will also fire when you use arrow keys and other means. I think you get what I mean... but then maybe that is just what you are looking for.
Related
I am developing an MRTK app for Hololens and mobile platforms and I am using the default MRTK buttons with scripts assigned to them.
In-Editor (when using the hand interaction simulation tool) the buttons work as intended (instanciating a 3d model on press, either with finger touching or left mouse click while the button is centered).
When testing the buttons on my mobile phone on Android, tapping the buttons triggers the sound of being pressed, but nothing happens. I use the DefaultHololens2InputSystemProfile in the MRTK.
Things I checked:
Button Events triggering correct in the Editor
Things I don't know how to check:
EventConsole/Some kind of output on Android to check if the Assets or the Buttons are the problem
Any ideas of what I can try?
You got to use the Onclick() event instead of the ButtonPressed, -Released etc. events you usually use for clicking in AR. You should find it right below the ButtonReleased event.
I want the keydown (or up) event for an edit-box so I can do a database lookup for the text entered so far. This works fine in Windows, but on Android only the Enter is send.
Does anyone know how to capture the key-events in XE5 of the virtual keyboard?
I don't think that detecting keyboard events was ever the right way to solve this problem. That's because there are many ways of getting text into a control, and not all of them involved pressing keys. You are really trying to detect when the text of the edit control changes. For that you simply listen to the OnChangeTracking event.
I want to make a walkie-talkie app using the power button as Push-to-talk.
Therefore i need to replace the button's behavoir to
Using onKeyDown onKeyUp or OnKeyLongPressed() trigger events works to receive, but after thre trigger event is processed, screen goes off.
What i have found searching
Overriding the power button in Android
How to hook into the Power button in Android?
doesn't help me since i can't get the Cyanogenmod to work on this phone.
Maybe you have some Idea.
Thank you in advance.
You cannot change the behavior of the power button, except via your own custom ROM mod (e.g., CyanogenMod).
I'm running a webapp on Android galaxytab.
I have 3 textbox with FocusHandler-s erasing the textbox content onFocus.
This works well but if the user uses the tab, previous or next buttons on the device's keyboard, the FocusEvent is not triggered.
I tried to catch Key events to prevent default action on TAB but the tab key is not triggerd either.
Does anyone know how to trigger a FocusEvent on tab or previous/next key press on an Android device keyboard? (Everything works well in computer's browser even if using tab key the focus event is triggered but not in Android's browser).
While this isn't a fix for your FocusHandler issue, if the content in the textbox that is being erased is a placeholder, perhaps you can benefit from this answer.
Take a look at http://www.m-gwt.com
The library provides placeholders for input elements in gwt.
I have two buttons that both have onTouchListeners and perform an action when pressed down. Why do they not work if you try to click both at the same time? I'm building for Android 1.6. I don't have a real device to test on, and you can't test clicking two things at the same time in the emulator. Thanks for any help.
I'm no expert, but my guess would be the following,
All gui-interaction is done through the UI-thread. Unless you do some special treatment of the buttons, you'll end up processing "click 1" with the UI-thread, while the user does "click 2" (at a time when the UI-thread is busy somewhere else). That is, the UI will not be responsive during the second click.
Multitouch was only introduced in Android 2.x, so on 1.6 you're out of luck - not possible. Even with 2.x the default UI behavior is to be singletouch only for such events (ie button press).
I suppose it is possible to somehow extend the container view of those buttons to become multitouch friendly and actually pass the correct events to the buttons, but that would be quite hackish.
You can read more about multitouch here. And on page 3 you can see why the multitouch fails on the GUI: first touch event is ACTION_DOWN which is handled like it should be, and the second one is ACTION_POINTER_DOWN which the UI doesn't know how to handle.
As Roosma already mention, multitouch is available from 2.x version.
According downloading statistics from my app published at android market (already downloaded more then 16k persons) it looks like there are only a few dozens people that using Android 1.6 on their devices. So i think you should mouve to version 2.1 at least.
I hope it helps :)