Hello Dig, I'm looking at the GUIX source and the arguments for the prototype of gx_single_line_text_input_character_insert are (GX_SINGLE_LINE_TEXT_INPUT *text_input, GX_UBYTE *str, UINT str_size). I used this function in the past and it does what it's supposed to. For multi-line text input boxes you can set the length argument to -1 to let GUIX pick up the length of the string, but looking at the source for this function, I don't see any length check (besides, the last argument is unsigned). However, I think there's much better way of inserting characters into the input box, especially when you're using some sort of keyboard input (whether it's on-screen on via USB HID), and that's by sending events at the text box. Here's a snippet of code that does that: GX_EVENT gxe = {0}; gxe.gx_event_type = GX_EVENT_KEY_DOWN; gxe.gx_event_target = ID_TXT_INPUT; // here goes the widget id of the text box you'd like to put characters into // if the box accepts focus (and widget that triggers this event does not), you can // set the target to 0, meaning that whoever has focus will receive the event gxe.gx_event_payload.gx_event_ushortdata[0] = (USHORT) character; // this event uses ushort instead of uchar to support // unicode characters without any modifications gx_system_event_send(&gxe); The default event process for single line text input will understand (and handle) this event. In fact, the event process (when passed this event as an argument) will call xxx_keydown_process that then makes a call to xxx_character_insert. This is preferred way of inputting characters, as it also notifies parent widget that the text was edited by posting event GX_EVENT_TEXT_EDITED. Regards
↧