[181] | 1 |
|
---|
| 2 | /***********************************************************************
|
---|
| 3 |
|
---|
| 4 | $Id: input.c 342 2006-07-26 02:00:11Z root $
|
---|
| 5 |
|
---|
| 6 | Input dialog procecedure
|
---|
| 7 |
|
---|
| 8 | Copyright (c) 1993-98 M. Kimes
|
---|
[342] | 9 | Copyright (c) 2005, 2006 Steven H. Levine
|
---|
[181] | 10 |
|
---|
| 11 | 28 May 05 SHL Use saymsg
|
---|
[342] | 12 | 14 Jul 06 SHL Use Runtime_Error
|
---|
[181] | 13 |
|
---|
| 14 | ***********************************************************************/
|
---|
| 15 |
|
---|
[2] | 16 | #define INCL_DOS
|
---|
| 17 | #define INCL_WIN
|
---|
[181] | 18 | #include <os2.h>
|
---|
[2] | 19 |
|
---|
| 20 | #include <stdlib.h>
|
---|
| 21 | #include <stdio.h>
|
---|
| 22 | #include <string.h>
|
---|
[181] | 23 |
|
---|
[2] | 24 | #include "fm3dll.h"
|
---|
| 25 | #include "fm3dlg.h"
|
---|
| 26 | #include "fm3str.h"
|
---|
| 27 |
|
---|
| 28 | #pragma alloc_text(FMINPUT,InputDlgProc)
|
---|
| 29 |
|
---|
[181] | 30 | MRESULT EXPENTRY InputDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
|
---|
| 31 | {
|
---|
| 32 | // mp2 points at a structure of type STRINGINPARMS
|
---|
| 33 | STRINGINPARMS *psip;
|
---|
| 34 | PSZ psz;
|
---|
[2] | 35 |
|
---|
[181] | 36 | switch(msg)
|
---|
| 37 | {
|
---|
[2] | 38 | case WM_INITDLG:
|
---|
[181] | 39 | if (!mp2)
|
---|
| 40 | {
|
---|
[342] | 41 | Runtime_Error(pszSrcFile, __LINE__, "no data");
|
---|
[181] | 42 | WinDismissDlg(hwnd,0);
|
---|
| 43 | break;
|
---|
[2] | 44 | }
|
---|
| 45 | WinSetWindowPtr(hwnd,0,(PVOID)mp2);
|
---|
[181] | 46 | psip = (STRINGINPARMS *)mp2;
|
---|
[342] | 47 | if (!WinSendDlgItemMsg(hwnd,STR_INPUT,EM_SETTEXTLIMIT,
|
---|
| 48 | MPFROM2SHORT(psip->inputlen,0),MPVOID))
|
---|
[181] | 49 | {
|
---|
[342] | 50 | Win_Error(hwnd,hwnd,__FILE__,__LINE__,
|
---|
| 51 | "setlimit failed");
|
---|
[181] | 52 | WinDismissDlg(hwnd,0);
|
---|
| 53 | break;
|
---|
[2] | 54 | }
|
---|
[181] | 55 | if (psip->prompt && *psip->prompt)
|
---|
| 56 | WinSetDlgItemText(hwnd,STR_PROMPT,psip->prompt);
|
---|
| 57 | if (psip->ret && *psip->ret)
|
---|
| 58 | {
|
---|
| 59 | WinSetDlgItemText(hwnd,STR_INPUT,psip->ret);
|
---|
| 60 | WinSendDlgItemMsg(hwnd,STR_INPUT,EM_SETSEL,
|
---|
| 61 | MPFROM2SHORT(0,strlen(psip->ret)),MPVOID);
|
---|
[2] | 62 | }
|
---|
[181] | 63 | *psip->ret = 0;
|
---|
| 64 | if (psip->title && *psip->title)
|
---|
| 65 | WinSetWindowText(hwnd,psip->title);
|
---|
[2] | 66 | break;
|
---|
| 67 |
|
---|
[181] | 68 | case WM_CONTROL: // don't care
|
---|
[2] | 69 | return 0;
|
---|
| 70 |
|
---|
| 71 | case WM_COMMAND:
|
---|
[181] | 72 | switch(SHORT1FROMMP(mp1))
|
---|
| 73 | {
|
---|
| 74 | case DID_OK:
|
---|
| 75 | psip = WinQueryWindowPtr(hwnd,0);
|
---|
| 76 | WinQueryDlgItemText(hwnd,STR_INPUT,psip->inputlen,psip->ret);
|
---|
| 77 | WinDismissDlg(hwnd,1);
|
---|
| 78 | break;
|
---|
[2] | 79 |
|
---|
[181] | 80 | case IDM_HELP:
|
---|
| 81 | psip = WinQueryWindowPtr(hwnd,0);
|
---|
| 82 | psz = psip->help && *psip->help ?
|
---|
| 83 | psip->help : GetPString(IDS_ENTERTEXTHELPTEXT);
|
---|
[2] | 84 |
|
---|
[181] | 85 | saymsg(MB_ENTER | MB_ICONASTERISK,
|
---|
| 86 | hwnd,
|
---|
| 87 | GetPString(IDS_HELPTEXT),
|
---|
| 88 | psz);
|
---|
| 89 | break;
|
---|
| 90 |
|
---|
| 91 | case DID_CANCEL:
|
---|
| 92 | WinDismissDlg(hwnd,0);
|
---|
| 93 | break;
|
---|
[2] | 94 | }
|
---|
| 95 | return 0;
|
---|
| 96 | }
|
---|
| 97 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
| 98 | }
|
---|
| 99 |
|
---|