ui/win32/text.c

changeset 879
d3acaa5fc3d8
parent 873
78853bfc47cf
child 880
9c99ff36513f
equal deleted inserted replaced
878:862a57990eb8 879:d3acaa5fc3d8
86 void ui_textfield_eventproc(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { 86 void ui_textfield_eventproc(W32Widget *widget, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
87 87
88 } 88 }
89 89
90 char* ui_textfield_get(UiString *s) { 90 char* ui_textfield_get(UiString *s) {
91 return NULL; // TODO 91 UiTextField *textfield = s->obj;
92
93 if (s->value.free) {
94 s->value.free(s->value.ptr);
95 }
96
97 int len = GetWindowTextLength(textfield->widget.widget.hwnd);
98 s->value.ptr = calloc(len+1, 1);
99 GetWindowText(textfield->widget.widget.hwnd, s->value.ptr, len+1);
100
101 return s->value.ptr;
92 } 102 }
93 103
94 void ui_textfield_set(UiString *s, const char *value) { 104 void ui_textfield_set(UiString *s, const char *value) {
95 // TODO 105 UiTextField *textfield = s->obj;
106 if (s->value.free) {
107 s->value.free(s->value.ptr);
108 }
109 s->value.ptr = NULL;
110 SetWindowText(textfield->widget.widget.hwnd, value);
96 } 111 }

mercurial