cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Keyboard Problem

jimmii
Senior II

Hey there,

I have a strange problem with my custom keyboard.

In the simulator everything looks and works fine. See image:0693W000000WBUpQAO.bmp

But when I download it to my target, following screen is presented:

0693W000000WBUzQAO.jpg

The touch events and the active rectangle are correct and the correct values are shown in the text area. See following image:0693W000000WBSpQAO.jpg

When touching e.g number 2, the overlapping numbers disappear. See:

0693W000000WBVxQAO.jpg

There seems to be a problem with displaying the numbers, the overall functionality seems to work.

Any ideas what's happening here?

Thanks a lot.

/jimmii

20 REPLIES 20
Martin KJELDSEN
Chief III

How are you defining these "Buttons" ?

jimmii
Senior II

HI @Martin KJELDSEN​ 

The Layout is defined as follows:

static const Keyboard::Layout layout =
{
    BITMAP_NUMERICKEYBOARD_ID,
    keyArray,
    10,
    callbackAreas,
    2,
    Rect(0, 0, 272-7, 88),
    TypedText(GetText(T_KEYBOARD_NUMERIC_TEXT_ENTERED, Typography::F_30_PT)),
    0xFFFF,
    Typography::F_30_PT,
    0xFFFF
};

And the Keys:

static const Keyboard::Key keyArray[10] =
{
    { 1, Rect(0 + 88 * 0, 88 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
    { 2, Rect(0 + 88 * 1, 88 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
    { 3, Rect(0 + 88 * 2, 88 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
 
    { 4, Rect(0 + 88 * 0, 153 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
    { 5, Rect(0 + 88 * 1, 153 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
    { 6, Rect(0 + 88 * 2, 153 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
 
    { 7, Rect(0 + 88 * 0, 218 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
    { 8, Rect(0 + 88 * 1, 218 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
    { 9, Rect(0 + 88 * 2, 218 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID},
 
    {10, Rect(0 + 88 * 1, 283 * 1, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID}
};

And the KeyMapping:

static const Keyboard::KeyMapping KeyMappingsNum[10] =
{
    { 1,  49},  // 1
    { 2,  50},  // 2
    { 3,  51},  // 3
    { 4,  52},  // 4
    { 5,  53},  // 5
    { 6,  54},  // 6
    { 7,  55},  // 7
    { 8,  56},  // 8
    { 9,  57},  // 9
    {10,  48}  // 0
};

Hope this helps.

/jimmii

Martin KJELDSEN
Chief III

The texts are suspiciously offset by what is probably 88 pixels for each row. I think maybe it would be easier if you sent the project. Just for fun, could you try putting in absolute coordinates rather than calculating them?

/Martin

jimmii
Senior II

It's not that easy - it's a confidential project.

I'll try to strip it down to the minimum.

But why is the keyboard displayed correctly in the simulator?

I don't know off the top of my head, that's why i wanted a project to play with. Maybe you could strip it down?

Did you try playing with absolute coordinates?

/Martin

jimmii
Senior II

Hey @Martin KJELDSEN​ 

OK, I will try to strip it down.

In the meantime I did some tests. I only displayed one digit to keep it simple.

With this code (Button coordinates 0/0)

static const Keyboard::Key keyArray[1] =
{
    { 1, Rect(0, 0, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID}
}

I get this (which is correct, the label is "underneath" the active button):

0693W000000WFluQAG.jpg

With coordinates (88/0):

static const Keyboard::Key keyArray[1] =
{
    { 1, Rect(88, 0, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID}
}

I get: (Button moved correctly in x-position but the label is at the wrong position)

0693W000000WFmnQAG.jpg

With coordinates (0/88):

static const Keyboard::Key keyArray[1] =
{
    { 1, Rect(0, 88, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID}
}

Again, the button moved correctly in y-position, the label also moved but at the wrong position.

0693W000000WFnvQAG.jpg

With coordinates (88/88):

static const Keyboard::Key keyArray[1] =
{
    { 1, Rect(88, 88, 82, 62), BITMAP_NUMERICKEYBOARDBUTTON_ID}
}

The button and the label are at the correct position (label underneath the active button)

0693W000000WFoUQAW.jpg

It seems as the label corrdinates are not translated correctly. I'm using the display in portrait mode. Is there a difference as how the simulator translates the coordinates in comparison to the "target" code?

Maybe you can reproduce this with the sample keyboard code (I also took that code and adapted it to my requirements)

In the meantime I will provide the code for you.

Thanks a lot.

/jimmii

jimmii
Senior II

Hi @Martin KJELDSEN​ 

I have attached the project. As we are using a custom HW it doesn't make sense to strip down our Keil Project.

Hope this helps.

/jimmii

jimmii
Senior II

Hi @Martin KJELDSEN​ 

Any suggestions?

Could it be related to the use of the ARMCLANG library?

Regards, /jimmii

Martin KJELDSEN
Chief III

Hi jimmii,

Thanks for the update. It shouldn't have anything to do with ARMCLANG specifically. It may have something to do with the orientation,but i also kind of doubt that. I'll try to check out your project and maybe replicate this on my own end.

Thanks!

/Martin