X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Frenderers%2Fwidget.c;h=46b3198ae030be49afa9a7817d0db49a185fc6c8;hb=fb3abbad5dfd71ea2b190d0b33d9c57e879fb15a;hp=586a5069491a859b416c09519e647b8b6b886b5c;hpb=94478ae8163d1ce92ed54550f03e76bb9f2e1802;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/renderers/widget.c b/Usermode/Applications/axwin3_src/WM/renderers/widget.c index 586a5069..46b3198a 100644 --- a/Usermode/Applications/axwin3_src/WM/renderers/widget.c +++ b/Usermode/Applications/axwin3_src/WM/renderers/widget.c @@ -392,7 +392,7 @@ tElement *Widget_GetElementByPos(tWidgetWin *Info, int X, int Y) tElement *ret, *next, *ele; next = &Info->RootElement; - while(next) + do { ret = next; next = NULL; @@ -405,7 +405,7 @@ tElement *Widget_GetElementByPos(tWidgetWin *Info, int X, int Y) if(Y >= ele->CachedY + ele->CachedH) continue; next = ele; } - } + } while(next); return ret; } @@ -552,6 +552,34 @@ void Widget_SetText(tWidgetWin *Info, int Len, const tWidgetMsg_SetText *Msg) // } } +int Widget_GetText(tWidgetWin *Info, int Len, const tWidgetMsg_SetText *Msg) +{ + if( Len < sizeof(*Msg) ) + return 0; + if( Len > sizeof(*Msg) ) + return 1; // Pass to user + + const char *text = NULL; + tElement *ele = Widget_GetElementById(Info, Msg->WidgetID); + if(ele) + text = ele->Text; + + char buf[sizeof(tWidgetMsg_SetText) + strlen(text?text:"") + 1]; + tWidgetMsg_SetText *omsg = (void*)buf; + + if( text ) { + omsg->WidgetID = Msg->WidgetID; + strcpy(omsg->Text, text); + } + else { + omsg->WidgetID = -1; + omsg->Text[0] = 0; + } + + WM_SendMessage(Info->RootElement.Window, Info->RootElement.Window, MSG_WIDGET_GETTEXT, sizeof(buf), buf); + return 0; +} + int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, const void *Data) { tWidgetWin *info = Target->RendererInfo; @@ -691,6 +719,8 @@ int Renderer_Widget_HandleMessage(tWindow *Target, int Msg, int Len, const void case MSG_WIDGET_SETTEXT: Widget_SetText(info, Len, Data); return 0; + case MSG_WIDGET_GETTEXT: + return Widget_GetText(info, Len, Data); // default: