Interactive Keyboard, using 'LEFT' 'RIGHT' 'UP 'DOWN' Buttons issue

Hi,

I am trying to create an interactive keyboard, which the user can navigate using the 'left 'right' 'up' 'down' buttons which prints the letters to the text box when the select button is pressed. I have added all the necessary components that I am aware I need but I am currently receiving the error

'Expected a native object. Irritants: (0)
Note: You will not see another error reported for 5 seconds.'

I am unsure how to resolve this, any help would be greatly appreciated. I have attached images of my app and code below.




Your index handling is off.

Indexes start at 1, not 0.
So you have to take that into account everywhere you check for boundary cases.
>=0 doesn't cut it.
Where you JOIN the selected letter to your output Label.Text, you must use a generic Button.Text to retrieve the Text from the button that you must SELECT from the list of buttons at position INDEX.

1 Like

Thank you, I will make these adjustments.

1 Like

Hi,

I have attempted to adjust the design based of the advice I received but the issue still remians.

Expected a native object. Irritants: (1)
Note: You will not see another error reported for 5 seconds.

Any advice on how this can be fixed would be greatly appreciated.


Maybe there:
image

It is expecting a button component...instead of a number:

1 Like

There is a special case to watch for when backspacing out of the last character in your input:
image

To clip the rightmost character of a string, the test is:

length > 1 ? (remove the rightmost)
otherwise return empty text


Still wrong.

Okay that's fixed the issue which I presented which is great, the RIGHT button is working exactly as expected. The left button whenever clicked however returns the highlighted key back to Q, the first in the list. I am also experiencing this error when I press the select key

RuntimeError. Irritants: (Property getter was expecting a com.google.appinventor.components.runtime.Button component but got a YailList instead. Problem with application)
Note: You will not see another error reported for 5 seconds.

I have attached this area of code below for reference. Any help would be greatly appreciated.

You have here the same error...It is expecting a button component...not a list:

Other thing...when you Initialize, CurrentIndex=1. If then you click on LEFT, you are setting CurrentIndex = CurrentIndex-1 (=0). then calling to UpdateSelectionIndicator with index=0 will fail.

Okay thank you, that has removed the issue but it will not show the letter in the textbox, just a string. For the left button should I set the index higher than 1, to ensure it does not reach zero?

Well, If your are in 'Q' and click on LEFT, you can't move further to the left, right?

Yes sorry I mean if I move using the right to say R, when I click the left button it shoots straight back to Q.

You need an "else" statement there:

Ah that's great thank you. The right and left are now working as expected. I am now just trying to tackle the issue of the up and down moving the highlighted key diagonally instead of vertically and why the text associated to each letter isn't shown in the box.

Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

1 Like

CG_APP.aia (10.0 KB)

Hi, I have attached this above.

That's great that has resolved that issue.Thank you.

If your rows have 6 elements, then you need to add/subtract 6 if moving up/down

1 Like

I have also managed to fix the UP,DOWN issue by changing it from 5 to 6. Thanks for your help.