source: trunk/dll/input.c@ 342

Last change on this file since 342 was 342, checked in by root, 19 years ago

Use Runtime_Error

  • 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 342 2006-07-26 02:00:11Z root $
5
6 Input dialog procecedure
7
8 Copyright (c) 1993-98 M. Kimes
9 Copyright (c) 2005, 2006 Steven H. Levine
10
11 28 May 05 SHL Use saymsg
12 14 Jul 06 SHL Use Runtime_Error
13
14***********************************************************************/
15
16#define INCL_DOS
17#define INCL_WIN
18#include <os2.h>
19
20#include <stdlib.h>
21#include <stdio.h>
22#include <string.h>
23
24#include "fm3dll.h"
25#include "fm3dlg.h"
26#include "fm3str.h"
27
28#pragma alloc_text(FMINPUT,InputDlgProc)
29
30MRESULT 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;
35
36 switch(msg)
37 {
38 case WM_INITDLG:
39 if (!mp2)
40 {
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 {
50 Win_Error(hwnd,hwnd,__FILE__,__LINE__,
51 "setlimit failed");
52 WinDismissDlg(hwnd,0);
53 break;
54 }
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);
62 }
63 *psip->ret = 0;
64 if (psip->title && *psip->title)
65 WinSetWindowText(hwnd,psip->title);
66 break;
67
68 case WM_CONTROL: // don't care
69 return 0;
70
71 case WM_COMMAND:
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;
79
80 case IDM_HELP:
81 psip = WinQueryWindowPtr(hwnd,0);
82 psz = psip->help && *psip->help ?
83 psip->help : GetPString(IDS_ENTERTEXTHELPTEXT);
84
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;
94 }
95 return 0;
96 }
97 return WinDefDlgProc(hwnd,msg,mp1,mp2);
98}
99
Note: See TracBrowser for help on using the repository browser.