home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1996 January
/
Chip_Special_Best_Web_Sites_01-96.iso
/
pc
/
zugang
/
maz
/
mazprocs.sa_
/
mazprocs.sa
Wrap
Text File
|
1994-11-23
|
9KB
|
222 lines
/***************************************************************************/
/********************* CLS Dialog Procedures **************************/
/***************************************************************************/
/*
** Purpose:
** Radio Button Group Dialog procedure for templates with one group
** of one to ten radio button controls.
**
** Controls Recognized:
** Radio - IDC_B1 to IDC_B10 (sequential)
** Pushbutton - IDC_B, IDC_C, IDC_H, IDC_X
**
** Initialization Symbols:
** "RadioDefault" - index (one-based) of radio button to be
** initialized as selected (default is "1").
** "OptionsGreyed" - list of (one-based) indexes of radio buttons
** to be initialized as disabled. Indexes not in the list will
** be left enabled.
**
** Termination Symbols:
** "ButtonChecked" - index of currently selected radio button.
** "DLGEVENT" - one of the following, depending on event:
** event value
** ---------- ----------
** IDC_B "BACK"
** IDC_C "CONTINUE"
** IDC_X "EXIT"
** IDCANCEL "CANCEL"
** STF_ACTIVATEAPP "REACTIVATE"
**
** Note:
** Pushbutton IDC_H will open the related Help dialog, if any.
**
*****************************************************************************/
BOOL FAR PASCAL FModemConfDlgProc(HWND hdlg, WORD wMsg, WORD wParam, LONG lParam)
{
char rgchNum[10];
int iButtonChecked;
char szSymBuf[cbSymBuf];
static WORD wSelStart = 0;
static WORD wSelEnd = 0;
char rgchText[cbFullPathMax + 1];
WORD i, cb, cItems, idc;
WORD cbLen;
switch (wMsg)
{
case STF_ACTIVATEAPP:
if (!FSetSymbolValue("DLGEVENT", "REACTIVATE"))
{
DestroyWindow(GetParent(hdlg));
return(fTrue);
}
ReactivateSetupScript();
return(fTrue);
case WM_INITDIALOG:
cb = CbGetSymbolValue("RadioDefault", szSymBuf, cbSymBuf);
Assert(cb < cbSymBuf);
if (*szSymBuf != '\0')
{
iButtonChecked = AsciiToInt((LPSTR)szSymBuf);
if (iButtonChecked < 1)
iButtonChecked = 0;
if (iButtonChecked > 10)
iButtonChecked = 10;
}
else
iButtonChecked = 1;
if (iButtonChecked != 0)
SendDlgItemMessage(hdlg, IDC_B0 + iButtonChecked, BM_SETCHECK,1,0L);
cItems = UsGetListLength("OptionsGreyed");
idc = IDC_B1;
for (i = 1; i <= cItems; ++i)
{
int iOpt;
cb = CbGetListItem("OptionsGreyed", i, szSymBuf, cbSymBuf);
Assert(cb < cbSymBuf);
iOpt = AsciiToInt((LPSTR)szSymBuf);
if (iOpt > 0
&& iOpt <= 10
&& iOpt != iButtonChecked)
EnableWindow(GetDlgItem(hdlg, IDC_B0 + iOpt), 0);
else if (*szSymBuf != '\0')
Assert(fFalse);
}
cb = CbGetSymbolValue("Modem_InitIn", szSymBuf, cbFullPathMax + 1);
Assert(cb < cbFullPathMax + 1);
SendDlgItemMessage(hdlg, Modem_Init, EM_LIMITTEXT, cbFullPathMax, 0L);
SetDlgItemText(hdlg, Modem_Init, (LPSTR)szSymBuf);
cb = CbGetSymbolValue("Modem_DialIn", szSymBuf, cbFullPathMax + 1);
Assert(cb < cbFullPathMax + 1);
SendDlgItemMessage(hdlg, Modem_Dial, EM_LIMITTEXT, cbFullPathMax, 0L);
SetDlgItemText(hdlg, Modem_Dial, (LPSTR)szSymBuf);
cbLen = lstrlen(szSymBuf);
cb = CbGetSymbolValue("EditFocus", szSymBuf, cbFullPathMax + 1);
Assert(cb < cbFullPathMax + 1);
if (lstrcmp(szSymBuf, "ALL") == 0)
{
wSelStart = 0;
wSelEnd = INT_MAX;
}
else if (lstrcmp(szSymBuf, "START") == 0)
{
wSelStart = 0;
wSelEnd = 0;
}
else /* default == END */
{
wSelStart = (WORD)cbLen;
wSelEnd = (WORD)cbLen;
}
return(fTrue);
case STF_REINITDIALOG:
return(fTrue);
case WM_COMMAND:
switch (wParam)
{
case IDC_H:
HdlgShowHelp();
return(fTrue);
case IDC_B1:
case IDC_B2:
case IDC_B3:
case IDC_B4:
CheckRadioButton(hdlg, IDC_B1, IDC_B4, wParam);
if (HIWORD(lParam) != BN_DOUBLECLICKED)
break;
wParam = IDC_C;
case Modem_Init:
if (HIWORD(lParam) == EN_SETFOCUS)
SendDlgItemMessage(hdlg, Modem_Init, EM_SETSEL, 0,
MAKELONG(wSelStart, wSelEnd));
else if (HIWORD(lParam) == EN_KILLFOCUS)
{
LONG l = SendDlgItemMessage(hdlg, Modem_Init, EM_GETSEL, 0, 0L);
wSelStart = LOWORD(l);
wSelEnd = HIWORD(l);
}
break;
case Modem_Dial:
if (HIWORD(lParam) == EN_SETFOCUS)
SendDlgItemMessage(hdlg, Modem_Dial, EM_SETSEL, 0,
MAKELONG(wSelStart, wSelEnd));
else if (HIWORD(lParam) == EN_KILLFOCUS)
{
LONG l = SendDlgItemMessage(hdlg, Modem_Dial, EM_GETSEL, 0, 0L);
wSelStart = LOWORD(l);
wSelEnd = HIWORD(l);
}
break;
case IDC_B:
case IDC_C:
case IDC_X:
case IDCANCEL:
if (!FSetSymbolValue("DLGEVENT", SzDlgEvent(wParam)))
{
DestroyWindow(GetParent(hdlg));
return(fTrue);
}
iButtonChecked = 0;
for (i = 1; i <= 10; i++)
if (SendDlgItemMessage(hdlg, IDC_B0 + i, BM_GETCHECK, 0, 0L))
{
iButtonChecked = i;
break;
}
IntToAscii((int)iButtonChecked, (LPSTR)rgchNum);
if (!FSetSymbolValue("ButtonChecked", rgchNum))
{
DestroyWindow(GetParent(hdlg));
return(fTrue);
}
SendDlgItemMessage(hdlg, Modem_Init, (WORD)WM_GETTEXT,
cbFullPathMax + 1, (LONG)((LPSTR)rgchText));
if (!FSetSymbolValue("Modem_InitOut", rgchText))
{
DestroyWindow(GetParent(hdlg));
return(fTrue);
}
SendDlgItemMessage(hdlg, Modem_Dial, (WORD)WM_GETTEXT,
cbFullPathMax + 1, (LONG)((LPSTR)rgchText));
if (!FSetSymbolValue("Modem_DialOut", rgchText))
{
DestroyWindow(GetParent(hdlg));
return(fTrue);
}
ReactivateSetupScript();
break;
}
break;
}
return(fFalse);
}