mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
postpone adding text to keep it from showing up highlighted. (Thx to B.T. for the tip.)
This commit is contained in:
parent
4a3d85e058
commit
d1698cb9fa
2 changed files with 11 additions and 5 deletions
|
@ -22,15 +22,16 @@
|
||||||
#include "ceutil.h"
|
#include "ceutil.h"
|
||||||
|
|
||||||
static void
|
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_U16 len;
|
||||||
XP_UCHAR* sbuf;
|
XP_UCHAR* sbuf;
|
||||||
wchar_t* wbuf;
|
wchar_t* wbuf;
|
||||||
|
CEAppGlobals* globals = init->globals;
|
||||||
|
|
||||||
sbuf = XP_MALLOC( globals->mpool, nBytes );
|
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,
|
len = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, sbuf, nBytes,
|
||||||
NULL, 0 );
|
NULL, 0 );
|
||||||
|
@ -70,8 +71,7 @@ StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
/* also want to expand the text box to the bottom */
|
/* also want to expand the text box to the bottom */
|
||||||
/* ceCenterCtl( hDlg, IDOK ); */
|
/* ceCenterCtl( hDlg, IDOK ); */
|
||||||
}
|
}
|
||||||
|
init->textIsSet = XP_FALSE; /* postpone to avoid highlight. */
|
||||||
stuffTextInField( hDlg, globals, init->stream );
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -80,6 +80,11 @@ StrBox(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
|
if ( !init->textIsSet ) {
|
||||||
|
stuffTextInField( hDlg, init );
|
||||||
|
init->textIsSet = XP_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
id = LOWORD(wParam);
|
id = LOWORD(wParam);
|
||||||
switch( id ) {
|
switch( id ) {
|
||||||
|
|
||||||
|
|
|
@ -32,4 +32,5 @@ typedef struct StrBoxInit {
|
||||||
XWStreamCtxt* stream;
|
XWStreamCtxt* stream;
|
||||||
XP_U16 result;
|
XP_U16 result;
|
||||||
XP_Bool isQuery;
|
XP_Bool isQuery;
|
||||||
|
XP_Bool textIsSet;
|
||||||
} StrBoxInit;
|
} StrBoxInit;
|
||||||
|
|
Loading…
Reference in a new issue