Call of DelChar() in LV_EVENT_INSERT event callback for text area crashes

I’m trying to make the delete key and backspace keys work in a text area. I get a callback for the LV_EVENT_INSERT event and I call DelChar() and I get an “Unhandled exception at 0x00007FF75370869F in LVGL.Simulator.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x00000016FD253F88).”
I’m unsure if DelChar() is meant to be able to be called in the LV_EVENT_INSERT callback. If it IS meant to be able to be called I can post my code.

DelCharForward() works except it deletes every char to the right of the cursor.

I’m working in the simulator on windows. LVGL is 8.3.6

Hi @mattb.351 ,

Backspace and delete are already implemented so you shouldn’t need to add an additional handler.

Backspace is expected to have a value of 8 and delete has a value 127.

The LVGL default handler is here for your reference and the key codes are defined in lv_group.h here.

I hope that helps.

Kind Regards,

Pete

I think I am having issues with ascii again. I’m getting 0xbe instead of ‘.’ (0x2e) and delete is coming in as 0x7f but wasn’t deleting characters so I implemented it myself. I’ll give it another test. Now I’ve set lv_set_accepted_characters(widget,“0123456789” ); and I’m seeing an LV_EVENT_INSERT event when I hit something not on the list like the ‘f’ key. Is that the correct behaviour?

Sorry function is lv_textarea_get_accepted_chars()

Yes, the delete is working fine without me calling DelCharForward(). Not sure what happened there.
I am definitely getting charcters not in the accepted list as well. Am I meant to filter these myself using lv_text_area_get_accepted_characters() ? If so it would be good if there was an is_character_accepted() type of function.