Article View: comp.windows.ms.programmer
Article #898Re: Formatted CONTROLs
From: Doug Conmy
Date: Fri, 14 Dec 1990 22:38
Date: Fri, 14 Dec 1990 22:38
43 lines
2237 bytes
2237 bytes
>Does anyone have a formatted edit control that I could examine? I want to
>create a control that will use COBOL PICture format specifications to make
>data entry more informative for the user of my application, but I'm not quite
>sure how to implement the control. I've considered creating a window and
>processing all the messages that would be required (... a lot of work...) or
>creating an edit control and modifying it's processing of user input...
One possible method of doing the above is to create a new window class
which has the procedure below with style CS
The procedure below is called whenever a control based on the class gets
messages. You can perform any special processing for the control (restrict
input to numbers only in the example below) and send the remaining messages
to the standard edit procedure. It may be desired that some additional
data is allocated for the class structure and the pointer to the edit
routine be stored in the class data. This will eliminate the need
for each instance of the class to look up the function pointer. However,
I am not sure it is possible to place information in the additional class
data area until you have a handle of an instance. Any ideas???
long FAR PASCAL NumWndProc(HWND hWnd, WORD msg, WORD wParam, LONG lParam)
[
static (FAR PASCAL *lpEditWndProc)();
switch (msg)
[
case WM
GetClassInfo(NULL, "edit", &WndClass);
lpEditWndProc = WndClass.lpfnWndProc;
break;
case WM
if (!isdigit(wParam) && isprint(wParam))
[
MessageBeep(0);
return(FALSE);
]
break;
]
return (CallWindowProc(lpEditWndProc, hWnd, msg, wParam, lParam));
]
I hope this helps.
DOUG.CONMY@OFFICE.WANG.COM
Technical Details
Message-ID:
<axo5gk.erw@wang.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!bu.edu!wang!newsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!bu.edu!wang!news From: DOUG.CONMY@OFFICE.WANG.COM (Doug Conmy) Newsgroups: comp.windows.ms.programmer Subject: Re: Formatted CONTROLs Message-ID: <axo5gk.erw@wang.com> Date: 14 Dec 90 22:38:10 GMT Sender: news@wang.com Organization: Mail to News Gateway Lines: 43