home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
formef.zip
/
FORMATEF.C
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-08
|
24KB
|
774 lines
#define INCL_DOS
#define INCL_PM
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include "GpfUC.h"
static UCHAR PictureMask[81];
#include "FormatEF.h"
#include "FEFProgs.h"
/**********************************************/
/**** F O R W A R D D E F I N I T I O N S ***/
/**********************************************/
static void fillstar(PWINBLK win) ;
static SHORT processChar(SHORT ch,PWINBLK win) ;
static SHORT remwaste(PUCHAR buf,PSYNGROUP desc) ;
static void fillfirst(PWINBLK win) ;
static SHORT createdesc(PUCHAR patt) ;
static PSYNGROUP creategroup(USHORT descQ,GROUPTYPE type,
SHORT min,SHORT max,UCHAR code);
static EFSTATE snapStatus(PWINBLK win) ;
int searchg(GROUPTYPE type,PSYNGROUP patt ,SHORT oldn,UCHAR ch) ;
/**********************************************/
/******** S T A T I C D A T A ****************/
/**********************************************/
UCHAR dateAm[] = "##/##/####";
PUCHAR datprt[3] = {dateAm,"##-##-####","####.##.##"};
PUCHAR txtptr[10] = {
dateAm,
"##.##",
"(###)###-####",
"$********#.#*",
"#####-****",
"###-##-####",
"-*****#",
"-*******#.#******",
"-*******#.*******E-**",
PictureMask};
unsigned char buf[MFEFMAXLEN];
SYNGROUP desc [40];
/**********************************************/
/************* C O D E S **********************/
/**********************************************/
static void getstate(PWINBLK win,EFSTATE err,PUCHAR buf) {
ULONG minmax;
win->state = err;
strcpy (win->buf,buf);
minmax = (ULONG) WinSendMsg(win->hwnd, EM_QUERYSEL,
MPFROMP(NULL),MPFROMP(NULL));
win->min = (SHORT)minmax;
win->max = (SHORT)(minmax >> 16);
win->first = (SHORT) WinSendMsg(win->hwnd, EM_QUERYFIRSTCHAR,
MPFROMP(NULL),MPFROMP(NULL));
}
static void setstate(PWINBLK win) {
WinSetWindowText(win->hwnd, win->buf);
WinSendMsg(win->hwnd, EM_SETSEL,
MPFROM2SHORT(win->min,win->max),MPFROMP(NULL));
WinSendMsg(win->hwnd, EM_SETFIRSTCHAR,
MPFROMP(win->first),MPFROMP(NULL));
}
static EFSTATE snapStatus(PWINBLK win) {
EFSTATE err;
SHORT changepos = -1;
WinQueryWindowText(win->hwnd, sizeof(buf), buf);
err = SynErr(buf,win->desc,win->state);
if( err >= win->state ) {
if(win->state == INIT_S) {
changepos = remwaste(buf,win->desc);
}
getstate(win,err,buf);
if( win->min == win->max && changepos >= 0 && changepos < win->min) {
if(win->min>0) win->min --;
if(win->max>0) win->max --;
}
if(changepos >= 0) {
setstate(win);
}
} else setstate(win);
return err;
}
int searchg(GROUPTYPE type,SYNGROUP patt [],SHORT oldn,UCHAR ch) {
SHORT newn;
SYNGROUP pat;
SHORT found = 0;
for(newn = oldn + 1 ; ; newn ++) {
pat = patt[ newn ];
if( (pat.type != SEPAR_T && pat.type == type ) ||
(pat.type == SEPAR_T && pat.code == ch ) ) {
found = 1;
patt[newn].digcnt = 1;
patt[newn].blcnt = 0;
break;
}
if(pat.min > 0 ) break; // not skip an important group
patt[newn].digcnt = 0;
patt[newn].blcnt = 0;
}
if( found ) return newn;
else return -1;
}
EFSTATE SynErr( PUCHAR buf, PSYNGROUP patt, EFSTATE state) {
SHORT pos; // pos number in buf
BOOL errfound;
BOOL indg; // 'in-digit-group' status
SHORT digcnt; // digit count
SHORT blcnt; // blank count
UCHAR ch;
SHORT groupn;
SHORT groupnn;
BOOL chdigit;
groupn = -1;
errfound = 0;
indg = 0;
pos = 0;
do {
ch=buf[pos++];
chdigit = ch >= '0' && ch <= '9';
if( state == INIT_S && ch == ' ' ) chdigit = TRUE;
if( chdigit ) {
if(indg) {
if(ch != ' ')digcnt ++;
else blcnt ++;
} else {// dig & !indg
groupnn = searchg(DIGIT_T,patt,groupn,ch);
if(groupnn < 0 ) {
errfound = 3;
}
else { // dig &!indg &DIGIT found
groupn = groupnn;
digcnt = blcnt = 0;
if(ch != ' ')digcnt = 1;
else blcnt = 1;
indg = 1;
}
}
} else { // not digit
if(indg) {
patt[groupn].digcnt = digcnt;
patt[groupn].blcnt = blcnt;
indg = 0;
}
switch(ch) {
case '+':
case '-': // SIGN
groupnn = searchg(SIGN_T,patt,groupn,ch);
if(groupnn < 0 ) { errfound = 5; }
else { groupn = groupnn; }
break;
case 'E':
case 'e': // EXP
groupnn = searchg(EXP_T,patt,groupn,ch);
if(groupnn < 0 ) { errfound = 7; }
else { groupn = groupnn; }
break;
default :
groupnn = searchg(SEPAR_T,patt,groupn,ch);
if(groupnn < 0 ) { errfound = 8; }
else { groupn = groupnn; }
break;
}// end of switch
}// end of not digit
if(errfound) break;
}while(ch); // end of do-while
if(errfound) return ERROR_S; // struct error
/*********** syntax test *************/
for(groupn = 0; ;groupn++) {
if(patt[groupn].type == DIGIT_T &&
(patt[groupn].digcnt > patt[groupn].max ||
patt[groupn].digcnt < patt[groupn].min)) {
errfound = TRUE;
break;
}
if(patt[groupn].type == SEPAR_T && patt[groupn].code ==0) break;
}
if(errfound) return INIT_S; // DIGIT error
/*********** range test *************/
// if(!rangeErr(buf)) return RANGEGOOD_S;
// else
return SYNGOOD_S;
}// end of SYNTAX function
static PSYNGROUP creategroup(USHORT descQ,GROUPTYPE type,SHORT min,SHORT max,UCHAR code){
PSYNGROUP d = &desc[descQ];
d->type = type;
d->code = code;
d->min = min;
d->max = max;
return d;
}
static SHORT createdesc(PUCHAR patt) {
SHORT pos;
SHORT descN;
SHORT descQ;
UCHAR ch;
BOOL indg;
PSYNGROUP d;
indg = FALSE;
descQ = 0;
for(pos = 0; ;pos ++) {
ch = patt[pos];
switch(ch) {
case '#':
case '*':
if(!indg ) d = creategroup(descQ++,DIGIT_T,0,0,0);
indg = TRUE;
d->max ++;
if(ch =='#') d->min ++;
break;
case ',':
indg = FALSE;
if(indg) d->code = ',';
else d = creategroup(descQ++,SEPAR_T,1,1,ch);
break;
case 'E':
case 'e':
indg = FALSE;
d = creategroup(descQ++,EXP_T,1,1,ch);
break;
case '+':
case '-':
indg = FALSE;
d = creategroup(descQ++,SIGN_T,ch=='+'?1:0,1,ch);
break;
default:
indg = FALSE;
d = creategroup(descQ++,SEPAR_T,1,1,ch);
break;
}
if(ch == 0) break;
}// end of for
for(descN = 1 ; descN < descQ - 1 ; descN ++ ) {
if(desc[descN ].type == SIGN_T &&
desc[descN-1].type == DIGIT_T &&
desc[descN+1].type == DIGIT_T ) {
desc[descN].min = desc[descN].max = 1;
desc[descN].type = SEPAR_T;
}
}
return descQ;
}
static void fillfirst(PWINBLK win) {
PUCHAR buf = win->buf;
PSYNGROUP desc= win->desc;
PSYNGROUP gr;
BOOL firstposfound = FALSE;
SHORT i;
SHORT pos;
for(pos = 0, gr = desc ; ; gr++) {
switch(gr->type) {
case DIGIT_T:
if(!firstposfound) {
firstposfound = TRUE;
win->min = win->max = pos;
}
for(i=0; i<gr->min; i++ ) buf[pos++] = ' ';
break;
default:
if(gr->min > 0) buf[pos++] = gr->code;
break;
}// end of switch
if(gr->type == SEPAR_T && gr->code == 0) break;
}// end of for
}
static SHORT remwaste(PUCHAR buf,PSYNGROUP desc) { // is called only after Syn
SHORT pos,pos1;
PSYNGROUP gr;
SHORT origlen;
BOOL changed = FALSE;
SHORT fstpos;
SHORT delcnt;
SHORT i;
UCHAR ch;
pos = pos1 = 0;
for( gr = desc ; ; gr++ ) {
origlen = gr->blcnt+gr->digcnt;
if(gr->blcnt && origlen > gr->min) {
if(gr->blcnt <= origlen - gr->min) delcnt = gr->blcnt;
else delcnt = origlen - gr->min;
} else delcnt = 0;
// if(delcnt) changed = TRUE;
gr->blcnt -= delcnt;
for( i = 0; i < origlen ; i++ ) {
if( (ch = buf[pos++]) == ' ' && delcnt >0) {
delcnt --;
if(!changed) {
changed = TRUE;
fstpos = pos - 1;
}
}
else buf[pos1++] = ch;
}
if(gr->type == SEPAR_T && gr->code == 0) break;
}// end of for
return changed?fstpos:-1;
}
static void fillstar(PWINBLK win) {
SHORT pos;
PSYNGROUP gr;
SHORT origlen;
SHORT i;
UCHAR gapcode;
pos = 0;
if(win->state != INIT_S ) {
return;
} else {
strcpy(win->starbuf,win->buf);
}
SynErr(win->starbuf,win->desc,INIT_S);
for( gr = win->desc ; ; gr++ ) {
origlen = gr->blcnt+gr->digcnt;
if( gr->type != DIGIT_T ||
(gr->digcnt >= gr->min && gr->digcnt <= gr->max) ) {
pos += origlen;
} else {
if( gr->digcnt < gr->min ) gapcode = '#';
else gapcode = '*';
for(i = 0 ; i < origlen ; i ++ ) win->starbuf[pos++] = gapcode;
}
if(gr->type == SEPAR_T && gr->code == 0) break;
}// end of for
WinSetWindowText(win->hwnd,win->starbuf);
}
static SHORT processChar(SHORT ch,PWINBLK win) {
SHORT endofgr,pos,grouplen,offs;
BOOL found;
PSYNGROUP gr;
if (win->min != win->max) return FALSE; // if it is not an insert mode
if (ch < 0x20 || ch > 0xFE) return FALSE; // control codes
pos = 0;
found = FALSE;
for( gr = win->desc ; ; gr++ ) {
grouplen = gr->blcnt+gr->digcnt;
if(pos+grouplen >= win->min) {
found = TRUE;
break;
} else {
pos += grouplen;
}
if(gr->type == SEPAR_T && gr->code == 0) break;
}// end of for
if(!found) return FALSE;
// pos - begin of group
endofgr = pos+grouplen == win->min;
if(gr->type != DIGIT_T) return FALSE;
if(!endofgr) {
if(ch >'9' || ch < '0') return TRUE; // ignore alfa inside dig.group
if(gr->digcnt >= gr->max) return TRUE; // ignore the group ovrflw
else return FALSE;
} else { // !!! it is between groups & Dig.gr at left
if(ch <='9' && ch >= '0') {
if( gr->digcnt < gr->max) return FALSE;// additional digit
// find next dig group ,if not full, change cursor and FALSE
for(offs=0,gr++;gr->type != SEPAR_T || gr->code !=0;
offs+=gr->digcnt+gr->blcnt,gr++) {
if(gr->type == DIGIT_T ) {
if(gr->digcnt >= gr->max) return TRUE; // ignore the group ovrflw
win->min+=offs; // change cursor
win->max+=offs;
setstate(win);
return FALSE; // insert to new group
}
}
return TRUE; // ignore, next dig group does not exist
} else { // ch isn't a digit
if( gr[1].type != SEPAR_T) return FALSE;
if( ch == (SHORT)gr[1].code) {
win->min++; // change cursor
win->max++;
setstate(win);
}
return TRUE; // ignore always
}
}
}
#define EXTRAWORDS (4 * sizeof(PVOID)) /* Extra window words */
static LONG Style;
static PFNWP pfnEditWndProc;
static SHORT ExtraOffset;
typedef struct
{
SHORT Reserved;
UCHAR PictureMask[1]; /* Undefine Length */
} EFCB;
/**********************************************************************/
/* */
/* Structure Control Data */
/* */
/**********************************************************************/
typedef struct
{
SHORT Length;
UCHAR Data[1]; /* Undefine Length */
} CTLDATA;
/**********************************************************************/
/* */
/* STATIC Function prototypes for private C functions */
/* */
/**********************************************************************/
PUCC EXPENTRY RegisterFormatEF( VOID );
MRESULT EXPENTRY fnwpFormatEF(
HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
LONG EXPENTRY ExtendedFormatEF( LONG WsStyle , CTLDATA *pCtlData);
MRESULT EXPENTRY fnwpExtendedFormatEF(
HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 );
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: RegisterFormatEF */
/* */
/**********************************************************************/
PUCC EXPENTRY RegisterFormatEF( VOID )
{
HAB hab;
CLASSINFO ClassInfo;
LONG flClassStyle;
static UCC Ucc;
hab = WinInitialize(0);
WinQueryClassInfo(hab, WC_ENTRYFIELD, (PCLASSINFO)&ClassInfo);
pfnEditWndProc = ClassInfo.pfnWindowProc;
flClassStyle = ClassInfo.flClassStyle; /* Class style */
flClassStyle &= ~CS_PUBLIC; /* Reset Public Flag */
ExtraOffset = ClassInfo.cbWindowData; /* Extra window words */
/********************************************************************/
/* Register the window class "FormatEF". */
/********************************************************************/
WinRegisterClass( /* Register window class */
hab, /* Anchor block handle */
"FORMATEF", /* Window class name (Upper)*/
(PFNWP)fnwpFormatEF, /* Address window procedure */
flClassStyle, /* Class style */
ClassInfo.cbWindowData+4 /* Extra window words */
);
Ucc.Capability = GPF_CAPS_WS_GROUP | /* Accept WS_GROUP Style */
GPF_CAPS_WS_TABSTOP | /* Accept WS_TABSTOP Style */
GPF_CAPS_TEXT | /* Accept TEXT */
GPF_CAPS_ACTION | /* Accept ACTION */
GPF_CAPS_EXTENDED | /* Accept EXTENDED */
GPF_CAPS_ASSOCIATE | /* Accept ASSOCIATE */
GPF_CAPS_PRESPARAMS | /* Accept PresParams */
GPF_ALIAS_ENTRYFLD; /* ENTRY FIELD */
Ucc.WsStyle = WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_AUTOSCROLL;
Ucc.Cx = 64;
Ucc.Cy = 12;
return (&Ucc);
}
/**********************************************************************/
/* */
/* WinProc: fnwpFormatEF */
/* */
/* Controls the "FormatEF" Area. */
/* */
/* */
/**********************************************************************/
MRESULT EXPENTRY fnwpFormatEF(
HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
{
// CHAR Key;
SHORT descQ;
PCREATESTRUCT pCrst;
PWINBLK win;
// EFCB *pEfcb;
MRESULT result;
CTLDATA *pCtlData;
SHORT flags;
SHORT ch;
SHORT vk;
SHORT Length;
/*******************************************************************/
/* Initialize Win Parameters */
/*******************************************************************/
win = (PWINBLK) WinQueryWindowULong(hwnd,ExtraOffset);
switch(msg)
{
/**************************************************************/
/* The application has asked for the window to be created. */
/**************************************************************/
case WM_CREATE:
pCrst = (PCREATESTRUCT) PVOIDFROMMP (mp2);
pCtlData = (CTLDATA*) pCrst->pCtlData;
if (pCtlData) {
if(pCtlData->Length) {
memcpy(PictureMask,pCtlData->Data,pCtlData->Length-1);
PictureMask[pCtlData->Length-1] = 0;
descQ = createdesc(PictureMask);
Length = sizeof(WINBLK);
DosAllocMem((PVOID*)&win,Length,PAG_READ|PAG_WRITE|PAG_COMMIT); /* Getmain */
memset(win,0,sizeof(WINBLK)); /* Clear Area */
win->hwnd = hwnd;
win->state = INIT_S;
win->insertmode = TRUE;
Length = sizeof(SYNGROUP) * descQ;
DosAllocMem((PVOID*)&win->desc,Length,PAG_READ|PAG_WRITE|PAG_COMMIT); /* Getmain */
memcpy(win->desc,desc,Length);
} else {
win = NULL;
}
} else { /* no pict. mask */
win = NULL;
}
pCrst->pCtlData = NULL; /* Reset CtlData for real EntryField */
WinSetWindowPtr(hwnd,ExtraOffset,win);
if(win) {
fillfirst(win);
WinSendMsg( hwnd,EM_SETINSERTMODE,MPFROMSHORT(TRUE),0L);
setstate(win);
}
return pfnEditWndProc( hwnd, msg, NULL, mp2 );
/**************************************************************/
/* The application has asked for the window to be destroyed. */
/**************************************************************/
case WM_DESTROY:
if(win == NULL) return pfnEditWndProc( hwnd, msg, NULL, mp2 );
WinSetWindowULong(hwnd,ExtraOffset,(ULONG)NULL);
DosFreeMem(win->desc);
DosFreeMem(win);
return pfnEditWndProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* Process Char */
/**************************************************************/
case WM_CHAR:
if(win == NULL) return pfnEditWndProc( hwnd, msg, NULL, mp2 );
if(win->star) return pfnEditWndProc( hwnd, msg, NULL, mp2 );
flags = SHORT1FROMMP(mp1);
ch = SHORT1FROMMP(mp2);
vk = SHORT2FROMMP(mp2);
if((flags & (KC_CHAR | KC_VIRTUALKEY)) && !(flags & KC_KEYUP) ) {
snapStatus(win);
if( flags & KC_CHAR) {
if( processChar(ch,win) )
return FALSE;
}
result = pfnEditWndProc( hwnd, msg, mp1, mp2 );
if(vk != VK_DOWN&&vk!=VK_UP&&vk!=VK_TAB&&vk!=VK_BACKTAB)
snapStatus(win);
return result;
}
return pfnEditWndProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* Process FocusChange */
/**************************************************************/
case WM_FOCUSCHANGE:
if(win == NULL) return pfnEditWndProc( hwnd, msg, NULL, mp2 );
if((BOOL)SHORT1FROMMP(mp2)) { // focus is received
win->star = FALSE;
WinSendMsg( hwnd,EM_SETINSERTMODE,MPFROMSHORT(win->insertmode),0L);
if(win->insertmode) win->max = win->min;
else win->max = win->min + 1;
setstate(win);
} else { // focus is losted
win->star = TRUE;
win->insertmode = (BOOL)WinSendMsg( hwnd,EM_SETINSERTMODE,MPFROMSHORT(TRUE),0L);
fillstar(win);
}
return pfnEditWndProc( hwnd, msg, mp1, mp2 );
/**************************************************************/
/* All other messages are passed to the default procedure. */
/**************************************************************/
default:
/* Pass all other messages to the default window procedure */
return pfnEditWndProc( hwnd, msg, mp1, mp2 );
}
}
/**********************************************************************/
/* */
/* PRIVATE FUNCTION: ExtendedFormatEF */
/* */
/**********************************************************************/
LONG EXPENTRY ExtendedFormatEF( LONG WsStyle , CTLDATA *pCtlData)
{
HWND hwndActive;
HMODULE hmod;
UCHAR Work[256];
Style = WsStyle; /* Set Local Style */
strncpy(PictureMask,pCtlData->Data,sizeof(PictureMask));
hwndActive = WinQueryActiveWindow( HWND_DESKTOP);
DosLoadModule(Work,sizeof(Work),(PSZ)"FormatEF",&hmod);
/* Invoke a modal dialog with the main window frame as owner */
WinDlgBox( HWND_DESKTOP, /* Parent */
hwndActive, /* Owner */
fnwpExtendedFormatEF, /* Address of dialog proc */
hmod, /* Module handle */
ID_FORMATEF, /* ID of dialog in resource */
NULL ); /* Initialization data */
pCtlData->Length = strlen(PictureMask)+1;
strcpy(pCtlData->Data,PictureMask);
return Style;
}
/**********************************************************************/
/* */
/* WinProc: fnwpExtendedFormatEF */
/* */
/* Controls the "ExtendedFormatEF" Area. */
/* */
/* */
/**********************************************************************/
MRESULT EXPENTRY fnwpExtendedFormatEF(
HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) {
static SHORT oldarn;
int arn,arnd;
switch (msg)
{
case WM_INITDLG:
oldarn = 9; // ArOther
if (!(Style & (ES_CENTER | ES_RIGHT)) )
WinPostMsg( WinWindowFromID( hwnd, ID_LEFT ),
BM_SETCHECK,
MPFROM2SHORT( TRUE,0 ),
0L );
if ( (Style & ES_RIGHT) == ES_RIGHT )
WinPostMsg( WinWindowFromID( hwnd, ID_RIGHT ),
BM_SETCHECK,
MPFROM2SHORT( TRUE,0 ),
0L );
if ( (Style & ES_CENTER) == ES_CENTER )
WinPostMsg( WinWindowFromID( hwnd, ID_CENTER ),
BM_SETCHECK,
MPFROM2SHORT( TRUE,0 ),
0L );
if ( (Style & ES_MARGIN) == ES_MARGIN )
WinPostMsg( WinWindowFromID( hwnd, ID_MARGIN ),
BM_SETCHECK,
MPFROM2SHORT( TRUE,0 ),
0L );
if ( (Style & ES_AUTOSCROLL) == ES_AUTOSCROLL )
WinPostMsg( WinWindowFromID( hwnd, ID_AUTOSCROLL ),
BM_SETCHECK,
MPFROM2SHORT( TRUE,0 ),
0L );
WinSendDlgItemMsg( hwnd,
ID_PICTUREMASK,
EM_SETTEXTLIMIT,
MPFROMSHORT(sizeof(PictureMask)-1),
(MPARAM)NULL );
WinSetWindowText(WinWindowFromID(hwnd,ID_PICTUREMASK),PictureMask);
WinSendDlgItemMsg(hwnd,ID_AROTHER,BM_SETCHECK,
MPFROMSHORT(1),MPFROMP(NULL) );
WinEnableWindow(WinWindowFromID(hwnd,ID_EFMIN),FALSE );
WinEnableWindow(WinWindowFromID(hwnd,ID_TIME12),FALSE );
WinEnableWindow(WinWindowFromID(hwnd,ID_RANGE),FALSE );
WinEnableWindow(WinWindowFromID(hwnd,ID_EFMAX),FALSE );
break;
case WM_CONTROL:
switch( SHORT1FROMMP( mp1 ) ) { // ID_
case ID_ARDATE: // 0
case ID_ARTIME: // 1
case ID_ARPHONE: // 2
case ID_ARMONEY: // 3
case ID_ARZIP: // 4
case ID_ARSSN: // 5
case ID_ARINT: // 6
case ID_ARDEC: // 7
case ID_AREXP: // 8
case ID_AROTHER: // 9
arn = (SHORT)WinSendDlgItemMsg(hwnd,ID_AROTHER,BM_QUERYCHECKINDEX,
MPFROMP(NULL),MPFROMP(NULL) );
if( arn != oldarn ) {
oldarn = arn;
WinSendDlgItemMsg(hwnd,ID_PICTUREMASK,EM_SETREADONLY,
MPFROMSHORT(arn != 9),MPFROMP(NULL) );
if(arn >= 0 && arn <= 9)
WinSetDlgItemText(hwnd,ID_PICTUREMASK,txtptr[arn]);
}
break;
case ID_DATEAM:
case ID_DATEEU:
case ID_DATEJA:
arnd = (SHORT)WinSendDlgItemMsg(hwnd,ID_DATEAM,BM_QUERYCHECKINDEX,
MPFROMP(NULL),MPFROMP(NULL) );
if( arnd >= 0 && arnd <= 2) txtptr[0] = datprt[arnd];
arn = (SHORT)WinSendDlgItemMsg(hwnd,ID_AROTHER,BM_QUERYCHECKINDEX,
MPFROMP(NULL),MPFROMP(NULL) );
if(arn == 0 ) WinSetDlgItemText(hwnd,ID_PICTUREMASK,txtptr[arn]);
break;
} // end of switch ID_
break;
case WM_COMMAND:
switch( SHORT1FROMMP( mp1 ) )
{
case ID_OK: /* Enter key pressed or pushbutton selected */
case DID_OK: /* Enter key pressed or pushbutton selected */
WinQueryWindowText(WinWindowFromID(hwnd,ID_PICTUREMASK),
sizeof(PictureMask),
PictureMask);
Style = 0;
if (SHORT1FROMMR( WinSendMsg( WinWindowFromID(hwnd,ID_RIGHT),
BM_QUERYCHECK,0L,0L)))
Style |= ES_RIGHT;
if (SHORT1FROMMR( WinSendMsg( WinWindowFromID(hwnd,ID_CENTER),
BM_QUERYCHECK,0L,0L)))
Style |= ES_CENTER;
if (SHORT1FROMMR( WinSendMsg( WinWindowFromID(hwnd,ID_MARGIN),
BM_QUERYCHECK,0L,0L)))
Style |= ES_MARGIN;
if (SHORT1FROMMR( WinSendMsg( WinWindowFromID(hwnd,ID_AUTOSCROLL),
BM_QUERYCHECK,0L,0L)))
Style |= ES_AUTOSCROLL;
WinDismissDlg( hwnd, TRUE ); /* Finished with dialog box */
break;
case ID_CANCEL: /* Escape key pressed or CANCEL pushbutton selected */
case DID_CANCEL: /* Escape key pressed or CANCEL pushbutton selected */
WinDismissDlg( hwnd, TRUE ); /* Finished with dialog box */
break;
default:
return WinDefDlgProc( hwnd, msg, mp1, mp2 );
}
break;
default: /* Pass all other messages to the default dialog proc */
return WinDefDlgProc( hwnd, msg, mp1, mp2 );
}
return FALSE;
}