source: trunk/dll/input.c@ 574

Last change on this file since 574 was 574, checked in by Gregg Young, 18 years ago

Use QWL_USER; Replace doesn't move the command and Okay on cmd dialog removed error on unchanged command

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