A89: Dialog Code


[Prev][Next][Index][Thread]

A89: Dialog Code



I have this code that generates a dialog with two pull downs, and then prints on the screen the options selected.  But everytime it exits, it causes the calc to lock up.  If someone can tell me what's wrong with my code it would be very appreciated.
 
void _main(void)
{
 HANDLE hDlg;
 HANDLE hPD1;
 HANDLE hPD2;
 int *nPDIndex;
 *nPDIndex = 1;
 *(nPDIndex + 1) = 1;
 
 hDlg = DialogNewSimple(200, 50);
 DialogAddTitle(hDlg, "Dialog Test", BT_OK, BT_NONE);
 
 hPD1 = PopupNew("", 19);
 PopupAddText(hPD1, -1, "Test Item 1", 1);
 PopupAddText(hPD1, -1, "Test Item 2", 2);
 PopupAddText(hPD1, -1, "Test Item 3", 3);
 DialogAddPulldown(hDlg, 6, 15, "Test PD", hPD1, 0);
 
 hPD2 = PopupNew("", 19);
 PopupAddText(hPD2, -1, "Test Item 1", 1);
 PopupAddText(hPD2, -1, "Test Item 2", 2);
 PopupAddText(hPD2, -1, "Test Item 3", 3);
 DialogAddPulldown(hDlg, 6, 25, "Test PD", hPD2, 1);
 
 DialogDo(hDlg, CENTER, CENTER, NULL, nPDIndex);
 
 ClrScr();
 
 printf_xy(0, 0, "PullDown 1 Value: %i", nPDIndex[0]);
 printf_xy(0, 10, "PullDown 2 Value: %i", nPDIndex[1]);
 
 ngetchx();
}