Changeset 551 for trunk/dll/input.c
- Timestamp:
- Feb 28, 2007, 2:33:51 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/input.c
r343 r551 30 30 #pragma alloc_text(FMINPUT,InputDlgProc) 31 31 32 MRESULT EXPENTRY InputDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)32 MRESULT EXPENTRY InputDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 33 33 { 34 34 // mp2 points at a structure of type STRINGINPARMS … … 36 36 PSZ psz; 37 37 38 switch(msg) 39 { 40 case WM_INITDLG: 41 if (!mp2) 42 { 43 Runtime_Error(pszSrcFile, __LINE__, "no data"); 44 WinDismissDlg(hwnd,0); 45 break; 46 } 47 WinSetWindowPtr(hwnd,0,(PVOID)mp2); 48 psip = (STRINGINPARMS *)mp2; 49 if (!WinSendDlgItemMsg(hwnd,STR_INPUT,EM_SETTEXTLIMIT, 50 MPFROM2SHORT(psip->inputlen,0),MPVOID)) 51 { 52 Win_Error(hwnd,hwnd,pszSrcFile,__LINE__, 53 "setlimit failed"); 54 WinDismissDlg(hwnd,0); 55 break; 56 } 57 if (psip->prompt && *psip->prompt) 58 WinSetDlgItemText(hwnd,STR_PROMPT,psip->prompt); 59 if (psip->ret && *psip->ret) 60 { 61 WinSetDlgItemText(hwnd,STR_INPUT,psip->ret); 62 WinSendDlgItemMsg(hwnd,STR_INPUT,EM_SETSEL, 63 MPFROM2SHORT(0,strlen(psip->ret)),MPVOID); 64 } 65 *psip->ret = 0; 66 if (psip->title && *psip->title) 67 WinSetWindowText(hwnd,psip->title); 38 switch (msg) { 39 case WM_INITDLG: 40 if (!mp2) { 41 Runtime_Error(pszSrcFile, __LINE__, "no data"); 42 WinDismissDlg(hwnd, 0); 43 break; 44 } 45 WinSetWindowPtr(hwnd, 0, (PVOID) mp2); 46 psip = (STRINGINPARMS *) mp2; 47 if (!WinSendDlgItemMsg(hwnd, STR_INPUT, EM_SETTEXTLIMIT, 48 MPFROM2SHORT(psip->inputlen, 0), MPVOID)) { 49 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, "setlimit failed"); 50 WinDismissDlg(hwnd, 0); 51 break; 52 } 53 if (psip->prompt && *psip->prompt) 54 WinSetDlgItemText(hwnd, STR_PROMPT, psip->prompt); 55 if (psip->ret && *psip->ret) { 56 WinSetDlgItemText(hwnd, STR_INPUT, psip->ret); 57 WinSendDlgItemMsg(hwnd, STR_INPUT, EM_SETSEL, 58 MPFROM2SHORT(0, strlen(psip->ret)), MPVOID); 59 } 60 *psip->ret = 0; 61 if (psip->title && *psip->title) 62 WinSetWindowText(hwnd, psip->title); 63 break; 64 65 case WM_CONTROL: // don't care 66 return 0; 67 68 case WM_COMMAND: 69 switch (SHORT1FROMMP(mp1)) { 70 case DID_OK: 71 psip = WinQueryWindowPtr(hwnd, 0); 72 WinQueryDlgItemText(hwnd, STR_INPUT, psip->inputlen, psip->ret); 73 WinDismissDlg(hwnd, 1); 68 74 break; 69 75 70 case WM_CONTROL: // don't care 71 return 0; 76 case IDM_HELP: 77 psip = WinQueryWindowPtr(hwnd, 0); 78 psz = psip->help && *psip->help ? 79 psip->help : GetPString(IDS_ENTERTEXTHELPTEXT); 72 80 73 case WM_COMMAND: 74 switch(SHORT1FROMMP(mp1)) 75 { 76 case DID_OK: 77 psip = WinQueryWindowPtr(hwnd,0); 78 WinQueryDlgItemText(hwnd,STR_INPUT,psip->inputlen,psip->ret); 79 WinDismissDlg(hwnd,1); 80 break; 81 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, GetPString(IDS_HELPTEXT), psz); 82 break; 81 83 82 case IDM_HELP: 83 psip = WinQueryWindowPtr(hwnd,0); 84 psz = psip->help && *psip->help ? 85 psip->help : GetPString(IDS_ENTERTEXTHELPTEXT); 86 87 saymsg(MB_ENTER | MB_ICONASTERISK, 88 hwnd, 89 GetPString(IDS_HELPTEXT), 90 psz); 91 break; 92 93 case DID_CANCEL: 94 WinDismissDlg(hwnd,0); 95 break; 96 } 97 return 0; 84 case DID_CANCEL: 85 WinDismissDlg(hwnd, 0); 86 break; 87 } 88 return 0; 98 89 } 99 return WinDefDlgProc(hwnd, msg,mp1,mp2);90 return WinDefDlgProc(hwnd, msg, mp1, mp2); 100 91 } 101
Note:
See TracChangeset
for help on using the changeset viewer.