Changeset 411 for trunk


Ignore:
Timestamp:
Apr 19, 2010, 9:09:40 PM (11 years ago)
Author:
dmik
Message:

Make Enter submit the edited text in multi-line entry fields. Ctrl+Enter may be used to start a new line.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/gui/docViewer.cpp

    r408 r411  
    102102            break;
    103103    }
     104}
     105
     106PFNWP oldMLEProc = NULL;
     107
     108MRESULT EXPENTRY MLEProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
     109{
     110    if ( msg == WM_CHAR )
     111    {
     112        USHORT fsflags = SHORT1FROMMP( mp1 );
     113        USHORT usch = SHORT1FROMMP( mp2 );
     114        USHORT usvk = SHORT2FROMMP( mp2 );
     115
     116        if ( ( fsflags & KC_VIRTUALKEY ) && !( fsflags & KC_CTRL ) &&
     117             usvk == VK_NEWLINE ) {
     118            // redirect to the parent to cause field submission
     119            HWND parent = WinQueryWindow( hwnd, QW_PARENT );
     120            return WinSendMsg( parent, msg, mp1, mp2 );
     121        }
     122    }
     123
     124    return oldMLEProc( hwnd, msg, mp1, mp2 );
    104125}
    105126
     
    208229                               HWND_TOP, DOC_ID_MLE, NULL, NULL );
    209230
     231    oldMLEProc = WinSubclassWindow( hWndMLE, MLEProc );
     232
    210233    char *mleFont = "10.Helvetica Bold";
    211234    WinSetPresParam( hWndMLE, PP_FONTNAMESIZE, strlen( mleFont ) + 1, mleFont );
Note: See TracChangeset for help on using the changeset viewer.