Remove overdesigned edit-control-caching mechanism in favor of just

asking if the current focus owner is an edit control.
This commit is contained in:
ehouse 2008-10-14 05:25:15 +00:00
parent 4dde28bc28
commit c81e85deef
2 changed files with 5 additions and 34 deletions

View file

@ -333,26 +333,6 @@ mkFullscreenWithSoftkeys( CEAppGlobals* globals, HWND hDlg, XP_U16 curHt,
return success;
} /* mkFullscreenWithSoftkeys */
static void
findEditCtrls( CeDlgHdr* dlgHdr )
{
HWND ctrl;
XP_U16 nEdits = 0;
for ( ctrl = GetWindow( dlgHdr->hDlg, GW_CHILD );
!!ctrl && nEdits < MAX_EDITS;
ctrl = GetWindow( ctrl, GW_HWNDNEXT ) ) {
wchar_t buf[32];
if ( 0 != GetClassName( ctrl, buf, VSIZE(buf) )
&& !wcscmp( L"Edit", buf ) ) {
XP_ASSERT( nEdits < MAX_EDITS );
dlgHdr->edits[nEdits++] = ctrl;
}
}
/* Sanity check: there are no Edits OR we're trapping them */
XP_ASSERT( (nEdits == 0) || ((dlgHdr->doWhat & DLG_STATE_TRAPBACK) != 0) );
} /* findEditCtrls */
#endif
#define TITLE_HT 20 /* Need to get this from the OS */
@ -409,7 +389,6 @@ ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat )
but I don't understand why: trapping here is still required. */
if ( IS_SMARTPHONE(globals) ) {
trapBackspaceKey( hDlg );
findEditCtrls( dlgHdr );
}
#endif
} /* ceDlgSetup */
@ -430,18 +409,12 @@ ceDlgComboShowHide( CeDlgHdr* dlgHdr, XP_U16 baseId )
static XP_Bool
editHasFocus( const CeDlgHdr* dlgHdr )
{
XP_Bool found = XP_FALSE;
HWND focus = GetFocus();
XP_U16 ii;
for ( ii = 0; ii < MAX_EDITS && !found; ++ii ) {
HWND ctrl = dlgHdr->edits[ii];
if ( NULL == ctrl ) {
break;
} else if ( ctrl == focus ) {
found = XP_TRUE;
}
}
return found;
wchar_t buf[32];
XP_Bool isEdit = !!focus
&& ( 0 != GetClassName( focus, buf, VSIZE(buf) ) )
&& !wcscmp( L"Edit", buf );
return isEdit;
} /* editHasFocus */
XP_Bool

View file

@ -48,7 +48,6 @@ typedef enum { DLG_STATE_NONE = 0
, DLG_STATE_TRAPBACK = 1
, DLG_STATE_DONEONLY = 2
} DlgStateTask;
#define MAX_EDITS 8 /* the most any control has */
typedef struct CeDlgHdr {
CEAppGlobals* globals;
HWND hDlg;
@ -56,7 +55,6 @@ typedef struct CeDlgHdr {
/* Below this line is private to ceutil.c */
DlgStateTask doWhat;
XP_U16 nPage;
HWND edits[MAX_EDITS];
} CeDlgHdr;
void ceDlgSetup( CeDlgHdr* dlgHdr, HWND hDlg, DlgStateTask doWhat );
void ceDlgComboShowHide( CeDlgHdr* dlgHdr, XP_U16 baseId );