From 0bc7948abf465480603ea9ba3a5d6e30ad8cca7e Mon Sep 17 00:00:00 2001 From: ehouse Date: Sat, 28 Feb 2004 05:21:26 +0000 Subject: [PATCH] postpone adding text to keep it from showing up highlighted. (Thx to B.T. for the tip.) --- xwords4/wince/cestrbx.c | 15 ++++++++++----- xwords4/wince/cestrbx.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/xwords4/wince/cestrbx.c b/xwords4/wince/cestrbx.c index 362eedcb1..9835f551d 100755 --- a/xwords4/wince/cestrbx.c +++ b/xwords4/wince/cestrbx.c @@ -22,15 +22,16 @@ #include "ceutil.h" static void -stuffTextInField( HWND hDlg, CEAppGlobals* globals, XWStreamCtxt* stream ) +stuffTextInField( HWND hDlg, StrBoxInit* init ) { - XP_U16 nBytes = stream_getSize(stream); + XP_U16 nBytes = stream_getSize(init->stream); XP_U16 len; XP_UCHAR* sbuf; wchar_t* wbuf; + CEAppGlobals* globals = init->globals; sbuf = XP_MALLOC( globals->mpool, nBytes ); - stream_getBytes( stream, sbuf, nBytes ); + stream_getBytes( init->stream, sbuf, nBytes ); len = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, sbuf, nBytes, NULL, 0 ); @@ -70,9 +71,8 @@ StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) /* also want to expand the text box to the bottom */ /* ceCenterCtl( hDlg, IDOK ); */ } + init->textIsSet = XP_FALSE; /* postpone to avoid highlight. */ - stuffTextInField( hDlg, globals, init->stream ); - return TRUE; } else { init = (StrBoxInit*)GetWindowLong( hDlg, GWL_USERDATA ); @@ -80,6 +80,11 @@ StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) switch (message) { case WM_COMMAND: + if ( !init->textIsSet ) { + stuffTextInField( hDlg, init ); + init->textIsSet = XP_TRUE; + } + id = LOWORD(wParam); switch( id ) { diff --git a/xwords4/wince/cestrbx.h b/xwords4/wince/cestrbx.h index da8ed502f..844bcb55e 100755 --- a/xwords4/wince/cestrbx.h +++ b/xwords4/wince/cestrbx.h @@ -32,4 +32,5 @@ typedef struct StrBoxInit { XWStreamCtxt* stream; XP_U16 result; XP_Bool isQuery; + XP_Bool textIsSet; } StrBoxInit;