[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

edit box data checks

You may have the need to do "real-time" checking of data that a user enters into an edit box, C_TextIn, such as data validation, etc. (e.g., Did the user enter a value in a valid range for that type of data?)

V does not currently allow this because it does not allow the vDialog::DialogCommand method to receive an event message about changes to the edit box, or when the focus leaves the edit box.

The modifications shown below will work with the Windows version of V, by checking for the Windows messages EN_CHANGE and EN_KILLFOCUS.

Question: Is anyone willing to provide us with similar mods for the X version (and OS/2 also)?

...Tom Hilinski

// ----------------------------------------------------------------------------
// Notes:
// V (as of this writing) does not allow the MS Windows messages
// EN_CHANGE and EN_KILLFOCUS to be detected by a dialog containing
// an edit control, C_TextIn.
// In order to allow these messages to be detected by a dialog, 
// the following changes to V must be made
// (these code snippets are from version 1.21):
// (1) In the function vDialog::DynamicDlgProc, file vdialog.cpp,
// comment out the check for EN_KILLFOCUS as shown below.
//     case WM_COMMAND:
//       {
//  switch (GET_WM_COMMAND_CMD(wParam, lParam))
//    {
//      case EN_ERRSPACE:
//      case EN_HSCROLL:
//      // case EN_KILLFOCUS:
// (2) In the function vTextInCmd::CmdCallback, file vtextinc.cpp,
// add the call to _parentWin->ProcessCmd in the "if" block, and
// add the "else if" block shown below:
//    if (codeNotify == EN_CHANGE)
//     {
//  HWND myHwnd = GetMyHwnd(_cmdId);
//  ::SendMessage(myHwnd, WM_GETTEXT, 130, (LPARAM)((LPSTR)_msg));
//  _parentWin->ProcessCmd(_cmdId, EN_CHANGE, dlgCmd->cmdType);
//     }
//    else if (codeNotify == EN_KILLFOCUS) // leaving edit box?
//     {
//  _parentWin->ProcessCmd(_cmdId, EN_KILLFOCUS, dlgCmd->cmdType);
//     }
// ----------------------------------------------------------------------------

Reply to: