Coded
Topic Author
Posts: 23
Joined: 23 Jul 2022, 21:46

key down / up and mouse android native

19 Aug 2022, 05:07

I wanted to know how do I make noesis understand that I'm clicking on a button or hovering over the UI, my application is working perfectly on windows but on android apparently nothing involving touch or keyboard keys is working

i'm using android native c++, i found an example in the code and copied it to mine but it still doesn't work, i need to activate something specific to know i'm using android?

code part:
case AMOTION_EVENT_ACTION_DOWN:
case AMOTION_EVENT_ACTION_POINTER_DOWN:
{
    int x = (int)AMotionEvent_getX(event, index);
    int y = (int)AMotionEvent_getY(event, index);
    NS_LOG_TRACE("MOTION_EVENT TouchDown %d;%d (%" PRIu64 ")", x, y, pointerId);
    ui->GetView()->TouchDown(x, y, pointerId);
    break;
}
case AMOTION_EVENT_ACTION_UP:
case AMOTION_EVENT_ACTION_POINTER_UP:
{
    int x = (int)AMotionEvent_getX(event, index);
    int y = (int)AMotionEvent_getY(event, index);
    NS_LOG_TRACE("MOTION_EVENT TouchUp %d;%d (%" PRIu64 ")", x, y, pointerId);
    ui->GetView()->TouchUp(x, y, pointerId);
    break;
}
case AMOTION_EVENT_ACTION_MOVE:
{
int numPointers = AMotionEvent_getPointerCount(event);
for (index = 0; index < numPointers; ++index)
{
pointerId = (uint64_t)AMotionEvent_getPointerId(event, index);
int x = (int)AMotionEvent_getX(event, index);
int y = (int)AMotionEvent_getY(event, index);
NS_LOG_TRACE("MOTION_EVENT TouchMove %d;%d (%" PRIu64 ")", x, y, pointerId);
ui->GetView()->TouchMove(x, y, pointerId);
}
break;
}
obs: the interface is rendering perfectly on android the positions are all just the same on windows i'm just having this problem with the touch and key
 
User avatar
jsantos
Site Admin
Posts: 3594
Joined: 20 Jan 2012, 17:18
Contact:

Re: key down / up and mouse android native

19 Aug 2022, 14:21

Do our examples (like Buttons) work correctly on your device?

On Android, you need to inject the corresponding touch events (as we are doing in our examples).
 
Coded
Topic Author
Posts: 23
Joined: 23 Jul 2022, 21:46

Re: key down / up and mouse android native

19 Aug 2022, 17:22

yes your examples work perfectly!

on windows my application has been working fine but on android it doesn't want to work unfortunately

for example the buttons I'm using this:

c++:
NS_CONNECT_EVENT(Button, Click, OnClickButton);
NS_CONNECT_EVENT(Button, MouseMove, OnMouseMove);
NS_CONNECT_EVENT(Button, MouseLeave, OnMouseLeave);

xaml:
<Button Style="{StaticResource Clean_Button}" Click="OnClickButton" MouseMove="OnMouseMove" MouseLeave="OnMouseLeave" />

I will be reviewing your example to try to understand what I could be doing wrong but in theory it would have to work I believe it is "right"

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 2 guests